Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Sha256 with 24 length key SWIFT #14

Open
lucianofedericoolmedo opened this issue Jan 4, 2019 · 0 comments
Open

Sha256 with 24 length key SWIFT #14

lucianofedericoolmedo opened this issue Jan 4, 2019 · 0 comments
Assignees

Comments

@lucianofedericoolmedo
Copy link

Hi, I have this snippet of code working with a sha256 with 32 length key

let plainText :String = "this is my plain text"
let key :String = "your key"
let cryptLib = CryptLib()
let iv = "5/LRE3jKOTCav8VB"
let size = 32
let sha = cryptLib.sha256(key, length: size)
let cipherText = cryptLib.encrypt(plainText.data(using: String.Encoding.utf8), key: sha, iv: iv)
print(cipherText!.base64EncodedString())
let elem = cryptLib.decrypt(cipherText, key: sha, iv: iv)
let salida = String.init(data: elem!, encoding: String.Encoding.utf8)
print(salida!)

But when i change size = 24, it fails the decrypt, is there any way to make the decryption it work ?, i am in a proyect that needs a 24 length key.

@skavinvarnan skavinvarnan self-assigned this Jan 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants