I have a problem converting this function, I would like someone to help me
Delphi code
function EnCripta(const InString:string; StartKey,MultKey,AddKey:Integer): string;
var I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString[I]) xor (StartKey shr 8));
StartKey := (Byte(Result[I]) + StartKey) * MultKey + AddKey;
end;
end;
JavaScrypt code
var EnCripta = function (inString, startKey, multKey, addKey) {
var I;
var result = "";
var vStartKey = startKey;
for (I = 0; I < inString.length; I++) {
var codigo = inString.charCodeAt(I) ^ (startKey >> 8);
codigo = codigo & 0xff;
var a = String.fromCharCode(codigo);
result = result.toString( 'ASCII' ) + a;
startKey = ((result.charCodeAt(I) + startKey) * multKey + addKey);
}
return result;
}
Some words that work, but not others
Please, if you have someone help me