Skip to content

Commit d5d2ed7

Browse files
committed
Fix the depricated warnings for Variant.sha512, replaced with Variant.sha2(.sha512)
1 parent cbaea38 commit d5d2ed7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Tests/web3swiftTests/localTests/web3swiftKeystoresTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class web3swiftKeystoresTests: XCTestCase {
7373
func testHMAC() throws {
7474
let seed = Data.fromHex("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b")!
7575
let data = Data.fromHex("4869205468657265")!
76-
let hmac = try! HMAC.init(key: seed.bytes, variant: HMAC.Variant.sha512).authenticate(data.bytes)
76+
let hmac = try! HMAC.init(key: seed.bytes, variant: HMAC.Variant.sha2(.sha512)).authenticate(data.bytes)
7777
XCTAssert(Data(hmac).toHexString() == "87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854")
7878
}
7979

@@ -198,7 +198,7 @@ class web3swiftKeystoresTests: XCTestCase {
198198
func testPBKDF2() throws {
199199
let pass = "passDATAb00AB7YxDTTl".data(using: .utf8)!
200200
let salt = "saltKEYbcTcXHCBxtjD2".data(using: .utf8)!
201-
let dataArray = try? PKCS5.PBKDF2(password: pass.bytes, salt: salt.bytes, iterations: 100000, keyLength: 65, variant: HMAC.Variant.sha512).calculate()
201+
let dataArray = try? PKCS5.PBKDF2(password: pass.bytes, salt: salt.bytes, iterations: 100000, keyLength: 65, variant: HMAC.Variant.sha2(.sha512)).calculate()
202202
XCTAssert(Data(dataArray!).toHexString().addHexPrefix().lowercased() == "0x594256B0BD4D6C9F21A87F7BA5772A791A10E6110694F44365CD94670E57F1AECD797EF1D1001938719044C7F018026697845EB9AD97D97DE36AB8786AAB5096E7".lowercased())
203203
}
204204

0 commit comments

Comments
 (0)