Re: Symmetric encryption sample code

Unknown <[email protected]> Wed, 01 May 2019 14:58:01 +0200
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
Hi Bertrand.

>However, i should ensure the data can be deciphered on the other side
>using unknown tech, and i can't manage to get the same results than
>this page :
>
>https://aesencryption.net
>"Mary had a little pike, its scales were smooth and shiny."
>"bbbbbbbbbbbbbbbb"
>128 bits
>Base64 result : "TVwyvflyoe2wLb2FmV1qmm1err+Knp+2ArGNh2N/A3coFId2CvqIkxMb4pw7c6E+Wxd3VOoHscAXnGTDPE/R3w=="

It looks like the above page uses AES in CBC mode (and NOT ECB mode
which Bill's example used).

Pike 8.x in reverse:

  object c = Crypto.AES.CBC.Buffer();
  c->set_decrypt_key("bbbbbbbbbbbbbbbb");
  c->set_iv("12345678b0z2345n");
  string raw = MIME.decode_base64("TVwyvflyoe2wLb2FmV1qmm1err+Knp+2ArGNh2N/A3coFId2CvqIkxMb4pw7c6E+Wxd3VOoHscAXnGTDPE/R3w==");
  string dec = c->unpad(raw, Crypto.PAD_PKCS7);
 
The IV has been reverse engineered, as it was missing in your data above.


	/grubba