Jump to content




Encryption changes every time


  • You cannot reply to this topic
2 replies to this topic

#1 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 28 June 2015 - 07:15 PM

I've written a quick proof-of-concept encryption program.
It isn't anything special yet, it uses SquidDev's AES API for encryption and decryption, though I have big plans ;)

Main program: http://pastebin.com/mX58vjWD
AES API: http://pastebin.com/r3CkkGsw
(You must name the api 'aes')

You enter a key and a secret, the program encrypts them, saves the result to a file (save.pass), then reads the file and decrypts it using the original key.

It spits out the correct result, but if you continuously enter the same password and the same key, the encryption always different...
And it correctly decrypts...

WHY?



Note that if you get the error 'newline Detected', it is to show when a newline (\n) was generated in the encryption
That is a story for another day...

#2 Anavrins

  • Members
  • 775 posts

Posted 28 June 2015 - 09:56 PM

That's because Squid's AES uses the the CBC mode of encryption, which requires a random IV for each encryption, see https://en.m.wikiped...de_of_operation

I'm not sure how SquidDev's api works, but you should be able to retrive the IV somehow.

#3 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 28 June 2015 - 11:56 PM

View PostAnavrins, on 28 June 2015 - 09:56 PM, said:

That's because Squid's AES uses the the CBC mode of encryption, which requires a random IV for each encryption, see https://en.m.wikiped...de_of_operation

I'm not sure how SquidDev's api works, but you should be able to retrive the IV somehow.

Oh ok that makes more sense, it creates some random characters to make it appear different each time.

Thanks :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users