diff options
| author | forsyth <forsyth@vitanuova.com> | 2011-01-17 11:10:35 +0000 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2011-01-17 11:10:35 +0000 |
| commit | d6b4eae8eb0a5ca3119414005e483fedd63a62d6 (patch) | |
| tree | 4959b04b1ae02ce5ccb4b3c0a8c459ff46587eb7 /appl/cmd/ssh/cipher3des.b | |
| parent | 9e6910dc0c747c8f30b87f6482f4eadb48ad6654 (diff) | |
20110117-1110
Diffstat (limited to 'appl/cmd/ssh/cipher3des.b')
| -rw-r--r-- | appl/cmd/ssh/cipher3des.b | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/appl/cmd/ssh/cipher3des.b b/appl/cmd/ssh/cipher3des.b deleted file mode 100644 index e6f347f1..00000000 --- a/appl/cmd/ssh/cipher3des.b +++ /dev/null @@ -1,51 +0,0 @@ -implement Cipher; - -include "sys.m"; - -include "ipints.m"; - ipints: IPints; - IPint: import ipints; - -include "crypt.m"; - crypt: Crypt; - DESstate: import crypt; - -include "sshio.m"; - -Cipherstate: adt -{ - enc: array of ref DESstate; - dec: array of ref DESstate; -}; - -cs: ref Cipherstate; - -id(): int -{ - return SSH_CIPHER_3DES; -} - -init(key: array of byte, nil: int) -{ - ipints = load IPints IPints->PATH; - crypt = load Crypt Crypt->PATH; - cs = ref Cipherstate(array[3] of ref DESstate, array[3] of ref DESstate); - for(i := 0; i < 3; i++){ - cs.enc[i] = crypt->dessetup(key[i*8:], nil); - cs.dec[i] = crypt->dessetup(key[i*8:], nil); - } -} - -encrypt(buf: array of byte, nbuf: int) -{ - crypt->descbc(cs.enc[0], buf, nbuf, Crypt->Encrypt); - crypt->descbc(cs.enc[1], buf, nbuf, Crypt->Decrypt); - crypt->descbc(cs.enc[2], buf, nbuf, Crypt->Encrypt); -} - -decrypt(buf: array of byte, nbuf: int) -{ - crypt->descbc(cs.dec[2], buf, nbuf, Crypt->Decrypt); - crypt->descbc(cs.dec[1], buf, nbuf, Crypt->Encrypt); - crypt->descbc(cs.dec[0], buf, nbuf, Crypt->Decrypt); -} |
