What I am trying to do is input a list of words, then have PHP code create a MD5 equivalent of each, then reformat the line to look like:
MD5:real_word
To go about this I would need to read the input one line at a time, create a MD5 equivalent, modify the line, then go on to the next line.
sample input:
cat
dog
people
How can I go from cat to dog, then dog to people?
MD5'ing a bunch at once
Moderator: General Moderators
-
HiddenS3crets
- Forum Contributor
- Posts: 119
- Joined: Fri Apr 22, 2005 12:23 pm
- Location: USA
-
HiddenS3crets
- Forum Contributor
- Posts: 119
- Joined: Fri Apr 22, 2005 12:23 pm
- Location: USA
-
HiddenS3crets
- Forum Contributor
- Posts: 119
- Joined: Fri Apr 22, 2005 12:23 pm
- Location: USA
-
HiddenS3crets
- Forum Contributor
- Posts: 119
- Joined: Fri Apr 22, 2005 12:23 pm
- Location: USA
I ended up solving this a different way... this is my code
Code: Select all
<?php
$str = $_POST['str'];
$length = str_word_count($str);
if(isset($str)) {
for($x = 0; $x < $length; $x++) {
$ind = explode("\n", $str);
$md5 = md5($ind[$x]);
echo $md5 . ":" . $ind[$x] . "<br>";
}
}
?>What feyd is suggesting, is something like:
So now you have the original text in the array $str, and the md5 hashed text in the array $md5str.
Code: Select all
<?php
$str = explode("\n", $_POST['str']);
$md5str = array();
foreach ($str as $val) {
$md5 = md5($val);
$md5str[] = $md5;
echo "$md5:$val<br />\n";
}
?>