benphp Posted February 27, 2009 Share Posted February 27, 2009 I have a $key = "mykey" and a string I want to encrypt with the key strEncrypt = "mypassword". I've looked for hours trying to find something that does this. Is there a function already developed? or is there an easy way to do this? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/147233-how-to-encrypt-a-string-using-a-key/ Share on other sites More sharing options...
RussellReal Posted February 28, 2009 Share Posted February 28, 2009 you mean $key would be a numeric salt.. or would be converted to a number and then used as salt? manually salted algorithms don't really work with systems where a user will log in and out lots of times, because you'll have an extra task of being able to match the password again if you want to confirm the user for being authentic Quote Link to comment https://forums.phpfreaks.com/topic/147233-how-to-encrypt-a-string-using-a-key/#findComment-772969 Share on other sites More sharing options...
stevehossy Posted February 28, 2009 Share Posted February 28, 2009 do you mean something like md5? for example user make account and password is google. md5 hash would be c822c1b63853ed273b89687ac505f9fa then when logging in it would decrypt that? Quote Link to comment https://forums.phpfreaks.com/topic/147233-how-to-encrypt-a-string-using-a-key/#findComment-773080 Share on other sites More sharing options...
Mark Baker Posted February 28, 2009 Share Posted February 28, 2009 do you mean something like md5? then when logging in it would decrypt that? MD5 isn't an encryption, it's a hash algorithm which is one way; so it's not possible to decrypt it. When logging in, you hash the entered password as well, then compare that with the stored hash... you don't decrypt ever because you can't Quote Link to comment https://forums.phpfreaks.com/topic/147233-how-to-encrypt-a-string-using-a-key/#findComment-773191 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.