I have a secret word (example. dirtydawg)
And using PHP I want to create the uppercase MD5 value of the ASCII equivalent of the secret word.
How do I do this????
I have a secret word (example. dirtydawg)
And using PHP I want to create the uppercase MD5 value of the ASCII equivalent of the secret word.
How do I do this????
I don't know what you mean with "ASCII equivalent", but I'm assuming what you ask for is this:
$hash = strtoupper(md5('dirtydawg'));
Or am I missing something?
Assuming by 'ASCII equivalent' you mean all chars in the word being ASCII values, you can do
strtoupper(md5(implode(array_map('ord', str_split('dirtydawg')))));
which is equivalent to
$secretWord = 'dirtydawg';
$hash = '';
for($i = 0; $i < strlen($secretWord); $i++) {
$hash .= ord($secretWord[$i]);
}
echo strtoupper(md5($hash));
Also see the PHP Manual on
ord
— Return ASCII value of characterDepending on what exactly "the uppercase MD5 value of the ASCII equivalent" means, you presumably either want:
md5(strtoupper($secretword));
or
strtoupper(md5($secretword));
PHP has pretty good documentation - have a look at http://www.php.net/md5 and http://www.php.net/strtoupper