Browse Source

Add Data(hex:) helper. #546

Marcin Krzyżanowski 7 years ago
parent
commit
08c75f48de
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Sources/CryptoSwift/Foundation/Data+Extension.swift

+ 4 - 0
Sources/CryptoSwift/Foundation/Data+Extension.swift

@@ -80,6 +80,10 @@ extension Data {
 
 extension Data {
 
+    public init(hex: String) {
+        self.init(bytes: Array<UInt8>(hex: hex))
+    }
+
     public var bytes: Array<UInt8> {
         return Array(self)
     }