         case .wifUncompressed:
             return serializePrivateKeyWIF (key: core, compressed: false)
         }
+    }
+
+    public func address (legacy: Bool) -> String? {
+        var addr = [CChar](repeating: 0, count: MemoryLayout<BRAddress>.size)
+        if legacy {
+            guard BRKeyLegacyAddr(&core, &addr, addr.count) > 0 else { return nil }
+        } else {
+            guard BRKeyAddress(&core, &addr, addr.count) > 0 else { return nil }
+        }
+        return String(cString: addr)
     }
 
     ///

            return (1 == BRKeySetPubKey (&key, dataAddr, dataCount)
                ? Key (core: key, needPublicKey: false, compressedPublicKey: false)
                : nil)
        }
    }


public final class Key {
    static public var wordList: [String]?

    static public func isWIFPrivateKey (key: Data) -> Bool {
        let keyStr = String (data: key, encoding: .utf8)!

        return keyStr.withCString { (keyPtr: UnsafePointer<Int8>) -> Bool in
            return 1 == BRPrivKeyIsValid (keyPtr)
        }
    }

    static public func isBIP38PrivateKey (key: Data) -> Bool {
        let keyStr = String (data: key, encoding: .utf8)!

        return keyStr.withCString { (keyPtr: UnsafePointer<Int8>) -> Bool in
            return 1 == BRBIP38KeyIsValid (keyPtr)
        }
    }

    static public func createFrom (phrase: String, words: [String]? = wordList) -> Key? {
        guard var words = words?.map ({ UnsafePointer<Int8> (strdup($0)) }) else { return nil }
        defer { words.forEach { free(UnsafeMutablePointer (mutating: $0)) } }
