Hi,
mal wieder ein typischer Fall davon, wie man hier falsche Antworten bekommt, wenn man das eigentlich zugrunde liegende Problem nicht beschreibt. Oder sich dessen gar nicht bewußt ist: Betriebsblindheit kennt viele Formen.
Genau wegen der Reduktion habe ich eine user friendly ID. Eine Kombination aus weniger Zahlen und Buchstaben ist leichter zu merken als eine lange Zahlenfolge ohne System.
Es ist also eine psychologische Frage, ein Problem der memnotischen Art, mit Subproblemen in Schrift und Sprache und gar nicht eine Frage der Datenkompression?
Dein Problem ist also leicht merkbare User-ID -- man kann das auch Benutzernamen nennen, Herr Kollege! Vielleicht hättest Du mit der Bezeichnung ja sogar das eigentliche Problem erkannt? ;-) -- zu bilden.
Da das je nach Schrift und Sprache verschieden ist, wäre eine Zahl natürlich die portabelste Lösung. Die einzig portable Lösung übrigens.
Wenn Du es jedoch auf lateinische Buchstaben beschränkst und auf indogermanische Sprachen kann ich Dir sagen, das eine Kombination aus "Konsonant-Vokal-Konsonant" gut merkbar ist, auch wenn mehrere dieser Gebilde hintereinander stehen. Man kann diese Kombination nämlich aussprechen, das sind Worte; vielleicht ohne Sinn und Verstand, werden jedoch als Worte angesehen.
Wolltest Du PHP, habe ich das richtig mitbekommen? Ich hatte mal als Beispiel einen APG (automated password generator) gebastelt, der auch aussprechbare Paßwörter ausgeben konnte, ähnlich APG.
Folgende Funktion war mal ein Beispiel und ist ein "schneller Hack am Abend: erquickend und labend" deshalb rate ich von mehr als "Ideenklau" dringendst ab! ;-)
/* Function buildPW() shamelessly stolen from Max Dobbie-Holman max@blueroo.net */
/* Added some letters, ripped substr(),gave it the numbers and a quality check
and some other stuff. Not much left of Max' work, but I feel better with
the address :) */
function buildPw($username) {
/* It might be a good idea, depending on the displaying font, to remove
either '0'(zero) or 'O'(capital 'o') or both */
$consts = 'AÄBCDEFGHIJKLMNOÖPQRSTUÜVWXYZaäbcdefghijklmnoöpqrsßtuüvwxyz1234567890';
/* You'll get pronouncable passwords, if you put only vowels in $vowels and
consonants in $consts respectivly.
But check checkEntropy() above for some adjustments (it's commented there)*/
$vowels = 'AÄBCDEFGHIJKLMNOÖPQRSTUÜVWXYZaäbcdefghijklmnoöpqrsßtuüvwxyz1234567890';
$const = $vow = $pw = "";
$ent = 0.0;
/* not really necessary */
$six = mixIt("012345");
for ($x=0; $x < 6; $x++) {
mt_srand ((double) microtime() * (1000000+$x));
/* The value '68' is the number of chars in $consts and $vowels respectivly.
If you change either, don't forget to change it here too. */
$const{$x} = $consts{mt_rand(0,68)};
$vow{$x} = $vowels{mt_rand(0,68)};
}
$pw = $const{$six{0}} .
$vow{$six{0}} .
$const{$six{1}} .
$vow{$six{1}} .
$const{$six{2}} .
$vow{$six{2}} .
$const{$six{3}} .
$vow{$six{3}};
/* This check reduces P(hit) by a small amount (calculation
left as an exercise for the reader) but increments
the distribution. Test $ent!=127.5 for optimum.
This is at least discussable, I know ;-)
And, worse, it may crash zend (memory exhaust) if you
test for $ent!=127.5 (BUG #1901)*/
$ent = checkEntropy($pw);
if($ent < 110 || $ent > 145 ) {
$pw = buildPw($username);
}
/* save password in a DB or whatever. You might also check
if the password is in use. */
if(savePw($username,$pw) == 0){
return $pw;
} else {
$pw = '<span style="font-size:200%;color:red;">Warning!</span><br />';
$pw = '<span style="font-size:150%;">Database Error</span><br />';
return $pw;
}
return NULL;
}
so short
Christoph Zurnieden