Re: DES Cipher
On Wed, Dec 22, 2010 at 05:50:19PM +0330, Mohammad Hedayati wrote: Can anyone please show me a sample code for ciphering using DES in FreeBSD? bdes(1)? % ls -al zzz % bdes zzz zzz.des Enter key: % -- Anton Shterenlikht Room 2.6, Queen's Building Mech Eng Dept Bristol University University Walk, Bristol BS8 1TR, UK Tel: +44 (0)117 331 5944 Fax: +44 (0)117 929 4423 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: DES Cipher
On 22/12/2010 14:20, Mohammad Hedayati wrote: Can anyone please show me a sample code for ciphering using DES in FreeBSD? To encrypt, something like: openssl enc -e -des -in plaintext.txt -a -out encrypted.asc Decrypt like so: openssl enc -d -dex -in encrypted.asc -a -out plaintext.txt Note: completely untested. You may well need to supply various extra arguments to make it all work. See 'openssl enc help' for hints. Note 2: DES is pretty trivial to crack nowadays. Don't use this for anything serious. You can encrypt using AES or any of a host of other ciphers by using a very similar openssl command line. Note 3: If you're actually after DES encrypted passwords, then see crypt(3). From the commandline you can use the Perl crypt function: 'perldoc -f crypt' for details. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matt...@infracaninophile.co.uk Kent, CT11 9PW signature.asc Description: OpenPGP digital signature
Re: DES Cipher
On Wed, Dec 22, 2010 at 6:01 PM, Anton Shterenlikht me...@bristol.ac.uk wrote: On Wed, Dec 22, 2010 at 05:50:19PM +0330, Mohammad Hedayati wrote: Can anyone please show me a sample code for ciphering using DES in FreeBSD? bdes(1)? % ls -al zzz % bdes zzz zzz.des Enter key: % -- Anton Shterenlikht Room 2.6, Queen's Building Mech Eng Dept Bristol University University Walk, Bristol BS8 1TR, UK Tel: +44 (0)117 331 5944 Fax: +44 (0)117 929 4423 no, des(3) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: DES Cipher
On 12/22/2010 9:35 AM, Mohammad Hedayati wrote: On Wed, Dec 22, 2010 at 6:01 PM, Anton Shterenlikht me...@bristol.ac.uk wrote: On Wed, Dec 22, 2010 at 05:50:19PM +0330, Mohammad Hedayati wrote: Can anyone please show me a sample code for ciphering using DES in FreeBSD? bdes(1)? % ls -al zzz % bdes zzz zzz.des Enter key: % no, des(3) /usr/src/crypto/openssl/crypto/des ---Mike ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: DES Cipher
From owner-freebsd-questi...@freebsd.org Wed Dec 22 08:22:15 2010 From: Mohammad Hedayati hedayati...@gmail.com Date: Wed, 22 Dec 2010 17:50:19 +0330 To: freebsd-questions@freebsd.org Subject: DES Cipher Can anyone please show me a sample code for ciphering using DES in FreeBSD? I hate to say it, but RTFM applies. 'apropos encryption' gives, among other things (and first), a cite to bdes(1). 'bdes' is a program that comes with the FreeBSD distribution. You have access to the source code of all of the distribution. 'Use the Souce, Luke applies, and will bring the mountain to Mohammad. :) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: DES Cipher
On Wed, Dec 22, 2010 at 7:33 PM, Robert Bonomi bon...@mail.r-bonomi.com wrote: From owner-freebsd-questi...@freebsd.org Wed Dec 22 08:22:15 2010 From: Mohammad Hedayati hedayati...@gmail.com Date: Wed, 22 Dec 2010 17:50:19 +0330 To: freebsd-questions@freebsd.org Subject: DES Cipher Can anyone please show me a sample code for ciphering using DES in FreeBSD? I hate to say it, but RTFM applies. 'apropos encryption' gives, among other things (and first), a cite to bdes(1). 'bdes' is a program that comes with the FreeBSD distribution. You have access to the source code of all of the distribution. 'Use the Souce, Luke applies, and will bring the mountain to Mohammad. :) Thanks Robert, I haven't seen a cite to bdes in the FM of des(3), but the problem is solved using the source of bdes(1) [thanks to Antone]. The code would be as easy as: #include openssl/des.h int main(int argc, char *argv[]) { DES_key_schedule schedule; DES_cblock key; strncpy(key, somekey, 8); DES_set_key(key, schedule); DES_cblock buf; strncpy(buf, sometxt, 8); // Encrypting DES_ecb_encrypt(buf, buf, schedule, 0); // Decrypting DES_ecb_encrypt(buf, buf, schedule, 1); printf(Text Is: %s\n, buf); return(0); } ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org