I lang tid har samarbejdsbranchen fokuseret på at forbedre enhedsfunktioner – bedre kameraer, klarere lyd og smartere software. Men den virkelige forvandling handler ikke om funktioner.
Crypt: http://dk.php.net/crypt "crypt() will return an encrypted string using the standard Unix DES-based encryption algorithm or alternative algorithms that may be available on the system. Arguments are a string to be encrypted and an optional salt string to base the encryption on. See the Unix man page for your crypt function for more information."
MD5: http://dk.php.net/md5 " Calculates the MD5 hash of str using the RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash."
DESCRIPTION crypt is the password encryption function. It is based on the Data Encryption Standard algorithm with variations intended (among other things) to discourage use of hardware implementations of a key search.
key is a user's typed password.
salt is a two-character string chosen from the set [a-zA-Z0-9./]. This string is used to perturb the algorithm in one of 4096 different ways.
By taking the lowest 7 bits of each of the first eight characters of the key, a 56-bit key is obtained. This 56-bit key is used to encrypt repeatedly a constant string (usually a string consisting of all zeros). The returned value points to the encrypted password, a series of 13 printable ASCII charac- ters (the first two characters represent the salt itself). The return value points to static data whose content is overwritten by each call.
Warning: The key space consists of 2**56 equal 7.2e16 possible values. Exhaustive searches of this key space are possible using massively parallel computers. Software, such as crack(1), is available which will search the portion of this key space that is generally used by humans for passwords. Hence, password selection should, at minimum, avoid common words and names. The use of a passwd(1) program that checks for crackable passwords during the selection process is recommended.
The DES algorithm itself has a few quirks which make the use of the crypt(3) interface a very poor choice for anything other than password authentication. If you are planning on using the crypt(3) interface for a cryptography project, don't do it: get a good book on encryption and one of the widely available DES libraries.
RETURN VALUE A pointer to the encrypted password is returned. On error, NULL is returned.
ERRORS ENOSYS The crypt function was not implemented, probably because of U.S.A. export restrictions.
GNU EXTENSION The glibc2 version of this function has the following additional features. If salt is a character string starting with the three characters "$1$" followed by at most eight characters, and optionally terminated by "$", then instead of using the DES machine, the glibc crypt function uses an MD5-based algorithm, and outputs up to 34 bytes, namely "$1$<string>$", where "<string>" stands for the up to 8 characters following "$1$" in the salt, followed by 22 bytes cho- sen from the set [a-zA-Z0-9./]. The entire key is significant here (instead of only the first 8 bytes).
Programs using this function must be linked with -lcrypt.
CONFORMING TO SVID, X/OPEN, BSD 4.3, POSIX 1003.1-2001
SEE ALSO login(1), passwd(1), encrypt(3), getpass(3), passwd(5)
crypt er en krypterings metode d.v.s. at du konvertere noget forståeligt til noget uforståeligt og kan senere konveretere det uforståelige tilbage til det originale forståelige. Det krypterede er lige så stort som originalen (evt. oprundet til et multipla af N bytes).
md5 er en hashing d.v.s. at noget forståeligt konverteres til noget uforståeligt som ikke kan konverteres tilbage igen. Hashen har en fast størrelse uanset hvor stor originalen er.
Men i og med, at man kan lave uendelig mange forskellige datakombinationer og længder må der nødvendigvis være min. 2 ens, da selve checksummen har begrænsninger. Ved MD5 er den 32 bytes (32 karakterer). Der bliver brugt a-z og 0-9 - sagt på en anden måde er der 35 valid tegn i en md5 checksum. Det betyder, at antallet af forskellige md5 checksums er 35^32, hvilket også er den del!!! Det kan omskrives til ca at være 2,57 * 10^49. Det er noget, man ikke kan forholde sig til, men man kan finde diverse sammenligningsmuligheder.
Teoretisk er den ikke unik, men i praksis er der ikke nogen problemer (endnu). Så vidt jeg ved, er det endnu heller ikke lykkedes af finde 2 forskellige datamænger med samme md5 checksum?
<flueknepperi> Der er vel 36 mulige tegn til brug i MD5? 26 bogstaver og 10 tal? :) Ikke at det ændrer meget, det samlede antal muligheder øges blot en smule: 6,3340286662973277706162286946812 * 10^49 </flueknepperi>
Du bør bruge md5 - men brug af md5 giver i sig selv ikke bedre sikkerhed, eller hvad du nu vil opnå; du skal bruge den rigtigt.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.