954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Encrypt function that returns x characters?

Does anyone know of a way to encrypt a string and output it as x number of characters? I need it to always return the same number of characters. I know MD5 always returns it as 32 characters. I'd like for it to return less that that, maybe 20 or 24 (the number has to be divisible by 4). And I'd like to be able to decrypt it. I can't figure out how to do it.

Can anyone give me suggestions?

Thanks!

calebcook
Junior Poster in Training
66 posts since Jun 2011
Reputation Points: 10
Solved Threads: 4
 

use AES and if its not divisible by 4 pick a character pseudo character to pad the buffer with and then split. and you will end up with more than 24bytes but it is 2 way encryption unlike md5 and sha variants. It always returns a value that is at least divisible by 2.

skraps
Light Poster
Banned
42 posts since Nov 2011
Reputation Points: 1
Solved Threads: 3
Infraction Points: 5
 

Theres a screenshot of the data that is produced once encrypting AES twice on a project that I was working on but have kinda stopped for the moment and getting ahold of myself Wordpress AES all data stored is divisible by 4 inside the database and is double encrypted at the time. I just need to add in somefunctions to store the data into a variable count the length with strlen and and then use substr to split it up and manipulate it a few more times.

skraps
Light Poster
Banned
42 posts since Nov 2011
Reputation Points: 1
Solved Threads: 3
Infraction Points: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: