We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi everyone,
I'm going to implement the Triple-DES to encrypt a password and I'm using the following command to validate the encryption output.
but I got a different encryption result.
Here's my code
func tripleDesEncrypt(inputStr: String, keyStr: String) -> String? { let key = CryptoUtils.byteArray(fromHex: keyStr) let iv = CryptoUtils.byteArray(fromHex: "0000000000000000") let plainText = CryptoUtils.byteArray(fromHex: inputStr) var textToCipher = plainText if plainText.count % Cryptor.Algorithm.tripleDes.blockSize != 0 { textToCipher = CryptoUtils.zeroPad(byteArray: plainText, blockSize: Cryptor.Algorithm.tripleDes.blockSize) } do { let cipherText = try Cryptor(operation: .encrypt, algorithm: .tripleDes, options: .pkcs7Padding, key: key, iv: iv).update(byteArray: textToCipher)?.final() print(CryptoUtils.hexString(from: cipherText!)) } catch let error { guard let err = error as? CryptorError else { return nil } print(err.description) } return nil }
Input inputStr: 0592389EDCBA96FF keyStr: 0123456789abcdeffedcba9876543210
Output d9f8e02413307c829b81df2a39d8c603
The right output should be a25fbc3a3ed409102e24eeb85aef49ae
Please advise.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi everyone,
I'm going to implement the Triple-DES to encrypt a password and I'm using the following command to validate the encryption output.
but I got a different encryption result.
Here's my code
The right output should be
a25fbc3a3ed409102e24eeb85aef49ae
Please advise.
The text was updated successfully, but these errors were encountered: