Archived Forum Post

Index of archived forum posts


how to use HEX key input - encryption

Aug 29 '14 at 04:11

lately im creating an AES encryption calculator based on chilkatcrypt code which has an hex key input and output. i thought there was something wrong with my code which never had a same output with another AEs encryption in the internet.

when i check the sample code from chilkat, i realized that the key input(data) which recognized as a string will be converted by chilkatcrypt to ascii code, resulting 1byte data per word (example : A=65, B=66, etc) and it will be recognized by chilkatsource as a hex key.

` Dim encStr As String encStr = crypt.EncryptStringENC("The quick brown fox jumps over the lazy dog.") MsgBox encStr`

then i know what went wrong but i dont know how to change the code from chilkat source with another reserved input method. is there anyone can help me solve this problem?

i know im not good when describing the problem, i hope someone will understand and help me.

great thanks

Accepted Answer

Use the crypt.SetEncodedKey method to specify a key in hex.


from the code you gave, will the code like this?

Dim encStr As String

encStr = crypt.EncryptBytesENC("000102030405060708090A0B0C0D0E0F")

crypt.SetEncodedKey encStr,"hex"

MsgBox encStr

im thinking about this method lately because the iv declared like this. really need more of explaination about the methods, cuz it will be so usefull.

thanks in advance, im gonna try wether this is working to my calculator.