2016-07-25 56 views

回答

1

將您的indata與鹽結合並運行哈希計算;

func hash(input: String, salt: String) -> String { 
    let toHash = input + salt 

    // TODO: Calculate the SHA256 hash of "toHash" and return it 
    // return sha256(toHash) 

    // Return the input data and hash for now 
    return toHash 
} 

print(hash("somedata", salt: "1m8f")) // Prints "somedata1m8f" 
+0

謝謝!沒關係,只需將鹽串添加到鍵即可! – kimpro

+0

葉普,應該這樣做! – Mattias