The Inbox: CryptoExtrasTests-rww.1.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: CryptoExtrasTests-rww.1.mcz

commits-2
A new version of CryptoExtrasTests was added to project The Inbox:
http://source.squeak.org/inbox/CryptoExtrasTests-rww.1.mcz

==================== Summary ====================

Name: CryptoExtrasTests-rww.1
Author: rww
Time: 28 August 2010, 6:55:32.037 am
UUID: ab4f39f6-af5c-3d44-a8c6-b200cba7ee67
Ancestors:

initial submission

==================== Snapshot ====================

SystemOrganization addCategory: #CryptoExtrasTests!

TestCase subclass: #CryptoMD2MD4Test
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'CryptoExtrasTests'!

----- Method: CryptoMD2MD4Test>>testMD2 (in category 'hash algorithms') -----
testMD2
        self assert: (MD2 hashMessage: '') asInteger = 16r8350E5A3E24C153DF2275C9F80692773.
        self assert: (MD2 hashMessage: 'a') asInteger = 16r32EC01EC4A6DAC72C0AB96FB34C0B5D1.
        self assert: (MD2 hashMessage: 'abc') asInteger = 16rDA853B0D3F88D99B30283A69E6DED6BB.
        self assert: (MD2 hashMessage: 'message digest') asInteger = 16rAB4F496BFB2A530B219FF33031FE06B0.
        self assert: (MD2 hashMessage: 'abcdefghijklmnopqrstuvwxyz') asInteger  = 16r4E8DDFF3650292AB5A4108C3AA47940B.
        self assert: (MD2 hashMessage: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') asInteger = 16rDA33DEF2A42DF13975352846C30338CD.
        self assert: (MD2 hashMessage: '12345678901234567890123456789012345678901234567890123456789012345678901234567890') asInteger = 16rD5976F79D83D3A0DC9806C3C66F3EFD8.!

----- Method: CryptoMD2MD4Test>>testMD4 (in category 'hash algorithms') -----
testMD4
        self assert: (MD4 hashMessage: #(115 0 115 0 110 0) asByteArray) = #(252 63 129 51 180 217 221 240 64 37 167 140 183 214 26 126) asByteArray!

TestCase subclass: #CryptoRC2Test
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'CryptoExtrasTests'!

----- Method: CryptoRC2Test>>genericARC2TestKey:effectiveKeyLength:plaintext:ciphertext: (in category 'testing') -----
genericARC2TestKey: key effectiveKeyLength: aLength plaintext: plainText ciphertext: ciphertext
        | vector rc2 |
        vector := plainText copy.
        rc2 := ARC2 key: key effectiveKeyLength: aLength.
        rc2 encryptBlock: vector.
        self assert: vector = ciphertext.
       
        rc2 decryptBlock: vector.
        self assert: vector = plainText.
        rc2 destroy.!

----- Method: CryptoRC2Test>>testARC2 (in category 'testing') -----
testARC2
        " All quantities are given in hexadecimal notation.

   Key length (bytes) = 8
   Effective key length (bits) = 63
   Key = 00000000 00000000
   Plaintext = 00000000 00000000
   Ciphertext = ebb773f9 93278eff "
       
        self genericARC2TestKey: (ByteArray fromHexString: '00000000 00000000') effectiveKeyLength: 63 plaintext: (ByteArray fromHexString: '00000000 00000000') ciphertext: (ByteArray fromHexString: 'ebb773f9 93278eff').

   "Key length (bytes) = 8
   Effective key length (bits) = 64
   Key = ffffffff ffffffff
   Plaintext = ffffffff ffffffff
   Ciphertext = 278b27e4 2e2f0d49"

        self genericARC2TestKey: (ByteArray fromHexString: 'ffffffff ffffffff') effectiveKeyLength: 64 plaintext: (ByteArray fromHexString: 'ffffffff ffffffff') ciphertext: (ByteArray fromHexString: '278b27e4 2e2f0d49').
 
   "Key length (bytes) = 8
   Effective key length (bits) = 64
   Key = 30000000 00000000
   Plaintext = 10000000 00000001
   Ciphertext = 30649edf 9be7d2c2"

        self genericARC2TestKey: (ByteArray fromHexString: '30000000 00000000') effectiveKeyLength: 64 plaintext: (ByteArray fromHexString: '10000000 00000001') ciphertext: (ByteArray fromHexString: '30649edf 9be7d2c2').

   "Key length (bytes) = 1
   Effective key length (bits) = 64
   Key = 88
   Plaintext = 00000000 00000000
   Ciphertext = 61a8a244 adacccf0"

        self genericARC2TestKey: (ByteArray fromHexString: '88') effectiveKeyLength: 64 plaintext: (ByteArray fromHexString: '00000000 00000000') ciphertext: (ByteArray fromHexString: '61a8a244 adacccf0').

   "Key length (bytes) = 7
   Effective key length (bits) = 64
   Key = 88bca90e 90875a
   Plaintext = 00000000 00000000
   Ciphertext = 6ccf4308 974c267f"

        self genericARC2TestKey: (ByteArray fromHexString: '88bca90e 90875a') effectiveKeyLength: 64 plaintext: (ByteArray fromHexString: '00000000 00000000') ciphertext: (ByteArray fromHexString: '6ccf4308 974c267f').

   "Key length (bytes) = 16
   Effective key length (bits) = 64
   Key = 88bca90e 90875a7f 0f79c384 627bafb2
   Plaintext = 00000000 00000000
   Ciphertext = 1a807d27 2bbe5db1"

        self genericARC2TestKey: (ByteArray fromHexString: '88bca90e 90875a7f 0f79c384 627bafb2') effectiveKeyLength: 64 plaintext: (ByteArray fromHexString: '00000000 00000000') ciphertext: (ByteArray fromHexString: '1a807d27 2bbe5db1').

   "Key length (bytes) = 16
   Effective key length (bits) = 128
   Key = 88bca90e 90875a7f 0f79c384 627bafb2
   Plaintext = 00000000 00000000
   Ciphertext = 2269552a b0f85ca6"

        self genericARC2TestKey: (ByteArray fromHexString: '88bca90e 90875a7f 0f79c384 627bafb2') effectiveKeyLength: 128 plaintext: (ByteArray fromHexString: '00000000 00000000') ciphertext: (ByteArray fromHexString: '2269552a b0f85ca6').

   "Key length (bytes) = 33
   Effective key length (bits) = 129
   Key = 88bca90e 90875a7f 0f79c384 627bafb2 16f80a6f 85920584
         c42fceb0 be255daf 1e
   Plaintext = 00000000 00000000
   Ciphertext = 5b78d3a4 3dfff1f1"

        self genericARC2TestKey: (ByteArray fromHexString: '88bca90e 90875a7f 0f79c384 627bafb2 16f80a6f 85920584 c42fceb0 be255daf 1e') effectiveKeyLength: 129 plaintext: (ByteArray fromHexString: '00000000 00000000') ciphertext: (ByteArray fromHexString: '5b78d3a4 3dfff1f1').!