Hi German,
ByteArray>>fromHexString: is an extension defined in the Cryptography-Core package. I missed it when I was creating the Blowfish packages. Thanks for finding that.
I've pasted the method below.
Paul
ByteArray>>#fromHexString: hexString "Returns a byteArray from a hex string. The hex string can have leading zeros that will not be truncated, preserving the size of the byteArray for things like cyrptograpy" | anInteger hexSize stringSize aStringOfHex | aStringOfHex := (hexString copyWithoutAll: (Array with: $ with: Character cr with: Character tab)). stringSize := aStringOfHex size. (stringSize > 3 and: [(aStringOfHex copyFrom: 1 to: 3) = '16r']) ifTrue: [anInteger := Number readFrom: (aStringOfHex asUppercase at: 3 put: $r; yourself). hexSize := aStringOfHex size - 3 / 2] ifFalse: [anInteger := Number readFrom: aStringOfHex asUppercase base: 16. hexSize := aStringOfHex size / 2]. ^ anInteger asByteArrayOfSize: hexSize asInteger
opsss, sorry, hehe, I totally forgot and tried blowfish in an image without Cryptography installed.
Sorry by the noise (trying to do hundreds of things at the same time is not good) :)
Cheers.
2011/5/15 Paul DeBruicker pdebruic@gmail.com:
Hi German,
ByteArray>>fromHexString: is an extension defined in the Cryptography-Core package. I missed it when I was creating the Blowfish packages. Thanks for finding that.
I've pasted the method below.
Paul
ByteArray>>#fromHexString: hexString "Returns a byteArray from a hex string. The hex string can have leading zeros that will not be truncated, preserving the size of the byteArray for things like cyrptograpy" | anInteger hexSize stringSize aStringOfHex | aStringOfHex := (hexString copyWithoutAll: (Array with: $ with: Character cr with: Character tab)). stringSize := aStringOfHex size. (stringSize > 3 and: [(aStringOfHex copyFrom: 1 to: 3) = '16r']) ifTrue: [anInteger := Number readFrom: (aStringOfHex asUppercase at: 3 put: $r; yourself). hexSize := aStringOfHex size - 3 / 2] ifFalse: [anInteger := Number readFrom: aStringOfHex asUppercase base: 16. hexSize := aStringOfHex size / 2]. ^ anInteger asByteArrayOfSize: hexSize asInteger _______________________________________________ Cryptography mailing list Cryptography@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/cryptography
cryptography@lists.squeakfoundation.org