Onward. So I've been looking for a CUDA DES library (preferably bitslice implementation), since there are no libraries out there I figure I'm gonna have to implement it myself. Having no background in cryptography I decided on first implementing standard DES and then moving on to bit slicing once I understand standard DES. One cannot run without first crawling. Therefore, I went in search of a how-to guide for implementing standard DES. Thankfully someone wrote a guide. Unfortunately step one has me confused. So they say there's supposed to be a key generated or inserted for the block cypher (DES) to use on the plaintext (password). The problem is that the php script** that generates a the DES hash only takes a password and salt (generated from the password), so I don't know if the password is the key or what. So my question is, is the password/plaintext the key?
A basic intro to block cypers and DES
**For reference here's the script in it's entirety:
Code: Select all
<?php
function hashtrip($input){
$input = stripslashes($input);
$trip = $input;
if(preg_match("##", $input)){
$trip = str_replace("#", "", $input);
}
if((function_exists('mb_convert_encoding'))){
mb_substitute_character('none');
$recoded_cap = mb_convert_encoding($trip, 'Shift_JIS', 'UTF-8');
}
$trip = (($recoded_cap != ) ? $recoded_cap : $trip);
$salt = substr($trip.'H.', 1, 2);
$salt = preg_replace('/[^\.-z]/', '.', $salt);
$salt = strtr($salt, ':;<=>?@[\]^_`', 'ABCDEFGabcdef');
$output = substr(crypt($trip, $salt), -10);
return $output;
}
?>
EDIT: Nix everything I just said. Okay so Unix crypt() is NOT the same thing as DES encryption. Crypt() is a cryptographic hash function. So that means implementing either crypt.c or going through PHP source code and finding crypt.c.