diff --git a/blake2/blake2/blake2utility.swift b/blake2/blake2/blake2utility.swift
index 5a926c2..0c79b06 100644
--- a/blake2/blake2/blake2utility.swift
+++ b/blake2/blake2/blake2utility.swift
@@ -6,3 +6,20 @@
//
import Foundation
+import CommonCrypto
+
+extension String {
+ public func unhexlify() -> [UInt8] {
+ var pos = startIndex
+ return (0.. String {
+ return self.map({ String(format: "%02x", $0) }).joined()
+ }
+}
diff --git a/blake2/blake2Tests/blake2Tests.swift b/blake2/blake2Tests/blake2Tests.swift
index 6346767..ffb2c37 100644
--- a/blake2/blake2Tests/blake2Tests.swift
+++ b/blake2/blake2Tests/blake2Tests.swift
@@ -25,6 +25,21 @@ class blake2Tests: XCTestCase {
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
}
+
+ func test1() {
+ let calc = Blake2.hash(data: [0x61, 0x62, 0x63])
+ print("\(calc.hexDescription())")
+ let expected:[UInt8] = [
+ 0xBA, 0x80, 0xA5, 0x3F, 0x98, 0x1C, 0x4D, 0x0D, 0x6A, 0x27, 0x97, 0xB6, 0x9F, 0x12, 0xF6, 0xE9,
+ 0x4C, 0x21, 0x2F, 0x14, 0x68, 0x5A, 0xC4, 0xB7, 0x4B, 0x12, 0xBB, 0x6F, 0xDB, 0xFF, 0xA2, 0xD1,
+ 0x7D, 0x87, 0xC5, 0x39, 0x2A, 0xAB, 0x79, 0x2D, 0xC2, 0x52, 0xD5, 0xDE, 0x45, 0x33, 0xCC, 0x95,
+ 0x18, 0xD3, 0x8A, 0xA8, 0xDB, 0xF1, 0x92, 0x5A, 0xB9, 0x23, 0x86, 0xED, 0xD4, 0x00, 0x99, 0x23
+ ]
+ XCTAssertEqual(calc.count, 64)
+ for i in 0..<64 {
+ XCTAssertEqual(calc[i], expected[i])
+ }
+ }
func testPerformanceExample() throws {
// This is an example of a performance test case.