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?


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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.