Re: 128 bit blowfish algorithm - WeOnlyDo Discussion board

Re: 128 bit blowfish algorithm (General questions)

by sovan, Tuesday, August 01, 2006, 12:54 (6689 days ago) @ wodSupport

I have applied what you have send me

the coding follows:
Dim crypt As New wodCryptCom
Dim i_blob As New MemBlob
Dim o_blob As New MemBlob
'i_blob.Text = 1271
i_blob.FromBase64( 1271 )
crypt.Type = CryptoTypes.Blowfish
crypt.SecretKey = 1111222233334444 '16byte key
crypt.Optimized = False
crypt.Padding = WODCRYPTCOMLib.CryptoPadding.PadPKCS7
crypt.Encrypt(i_blob, o_blob)
Dim str As String = o_blob.ToBase64
Response.Write(str)
Response.Write( <br> )
i_blob.FromBase64(str)
crypt.Decrypt(i_blob, o_blob)
Response.Write(o_blob.ToBase64)

the result is:
Encrypted value: gcnw/sxIYbM=
decrypted value: 1271

it runs fine but
We are using Product of TurboPower
it gives result:
Encrypted value: Hft4sSl5T5s=
decrypted value: 1271

so why these two encrypted values are not matched.
if this due to change of value to or from base64?
if there any error in avove coding?
sovan

Sovan,

that's not 128bit. It all depends on the lenght of the secret key. You must use 16 bytes key (128bit) to have 128bit Blowfish.

BTW in your code you specify 'SecretKey' and 'Password'? Perhaps you mixed them? Perhaps you used Base64 to read it in some cases, and forgot to use it in another cases?

Do you use CBC mode? If so, is your InitVector the same in all cases?

Kreso


Complete thread: