|
Posted by Peter Fox on 01/25/06 02:14
Following on from frizzle's message. . .
>Hi there,
>
>I need an encrypting function, but haven't got a clue where to start.
Ummm...yes - where to start.
I can't help feeling that you are not using the right method to do what
you're /really/ trying to achieve. If something is getting re-inputted
then why bother? If you want random numbers then you can generate
random strings with rand and md5 functions *and check input against
session vars* or values regenerated from a database seed.
There's an easy way to avoid o0 etc and that's by replacing one with
a distinctive character. NB 5s, 8B,1L,4A - many screens don't tell you.
I have a hunch you're trying too hard, but without a clearer idea of
what you're trying to do can't go further.
>First a string has to be encrypted with two different encryption keys.
>Both output should be anything a-z / A-Z / 0-9 with a fixed length
>(e.g. 20 chars).
>(Preferably the encryption keys should pick chars from a string i give
>them,
>to prevent l's and 1's, o's and 0's etc.)
>
>Then they get inputted again ( say $_POST['name'] and $_POST['code'] )
>and i have to decrypt them. I know $_POST['name'] should use
>decode/encode-key 1,
>and $_POST['code'] should use decode/encode-key 2.
>
>
>Decoded they should be the same again.
>(Example below.)
>
>I hope it's kind of clear ...
>
>Greetings frizzle.
>
>
>-------- EXAMPLE --------
>
>Input : foobar
>
>Output key 1 : klKpUR867Biwr742gsBd
>Output key 2 : 9KdfnbDSnd65sgh45hsd
>
>$_POST['name'] : klKpUR867Biwr742gsBd
>$_POST['code'] : 9KdfnbDSnd65sgh45hsd
>
>Result : foobar ( $_POST['name'] === $_POST['code'] )
>
--
PETER FOX Not the same since the porcelain business went down the pan
peterfox@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
[Back to original message]
|