Posts

Showing posts from August, 2025

crypto

function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if (MethodName == "EncryptString") { var plainText = Inputs.GetProperty("InputText"); var key = Inputs.GetProperty("Key"); var encrypted = XorCipher(plainText, key); var b64 = Base64Encode(encrypted); Outputs.SetProperty("Result", b64); return (CancelOperation); } else if (MethodName == "DecryptString") { var cipherB64 = Inputs.GetProperty("InputText"); var key = Inputs.GetProperty("Key"); var cipherText = Base64Decode(cipherB64); var decrypted = XorCipher(cipherText, key); Outputs.SetProperty("Result", decrypted); return (CancelOperation); } return (ContinueOperation); } /** * XOR-шифрование строки с ключом (обратимо) */ function XorCipher(text, key) { var outStr = ""; var keyLen = key.length; ...