String CryptPassword(String pwd)
{
String t_c ="InventVerw", encode ="", t_asc1, t_asc2, save_substr, save_substr2;
char *akt_char, *akt_char2, *saved_char, *saved_char2, *saved_encode;
int i, t_save, t_save2, t_e;
for (i=1; i<pwd.Length(); i++)
{
//Übergebenes Passwort zerlegen
save_substr = pwd.SubString(i,1);
save_substr2 = t_c.SubString(i,1);
//char - wert des Zeichens bilden
akt_char = save_substr.c_str();
akt_char2 = save_substr2.c_str();
//char - wert in
ASCII Code übersetzen
t_asc1 = IntToStr(*akt_char);
t_asc2 = IntToStr(*akt_char2);
//ShowMessage(t_asc1 +" "+ t_asc2);
if (t_asc1 > t_asc2)
{
t_e = (t_asc1-t_asc2)*2;
if (t_e > 127)
{
t_e = 76;
}
}
else if (t_asc1 < t_asc2)
{
t_e = (t_asc2 - t_asc1)*3;
if (t_e > 127)
{
t_e = 34;
}
}
else if (t_asc1 == t_asc2)
{
t_e = 68;
}
encode = encode + itoa(t_e, *saved_char);
ShowMessage(t_e);
}
return encode;
}