1

I'm setting up the code to generate the AES hash using with 3 random numbers to generate the hash, but I don't want to generate the hash that come with the keys such as like ?, /, +, =...etc.

Here is the output for the hash that I use to generate it:

U2FsdGVkX1+nF+bhzvA/sFnQKgOKwrRNJbqr+XzJ/2k=

I want to generate the AES hash that start with FM cap letters with the long random cap and small cap letters to make it to show like this:

FMfcgxwCgCRTpGWxctmfLpRBZxVcrkdM

Here is what I use to encrypt and decrypt the hash:

//encrypt the hash
var hash = '234';
var encryptedAES = CryptoJS.AES.encrypt(hash, "My Secret Passphrase");


//decrypt the hash
var decryptbytes = CryptoJS.AES.decrypt(hash.toString(), "My Secret Passphrase");
var email_number = decryptbytes.toString(CryptoJS.enc.Utf8);

What I'm expecting to do is to encrypt the hash using with the long random cap and small cap letters like FMfcgxwCgCRTpGWxctmfLpRBZxVcrkdM without the keys ?, -, = or whatever it is and I want to decrypt the hash to go back to numbers that I enter when I encrypted it.

Can you please show me an example how I could use CryptoJS.AES.encrypt to encrypt the numbers to turn into 32 letters that start with FM with the cap and small cap letters?

Thank you

Juan
  • 4,910
  • 3
  • 37
  • 46
Robert Jones
  • 390
  • 3
  • 18
  • AES 256bit hashes are 44 character long. Also, you cannot limit it to use only certain characters. – GrafiCode May 03 '19 at 16:35
  • @GrafiCodeStudio I didn't know that AES 256 bit hashes are 44 character long. So what do I need to use then? – Robert Jones May 03 '19 at 16:41
  • I don't know any algorithm that matches your specific request, can I ask you why do you need that formatting? – GrafiCode May 03 '19 at 17:02
  • @GrafiCodeStudio I want to use it to encrypt the number for email use. So is it possible to use `CryptoJS.AES.encrypt` to encrypt the numbers to turn into letters? – Robert Jones May 03 '19 at 17:12

0 Answers0