diff --git a/PhoenixCrypto/PhoenixCrypto/Classes/NativeWeakRandom.swift b/PhoenixCrypto/PhoenixCrypto/Classes/NativeWeakRandom.swift index cfb4734ad..267998e57 100644 --- a/PhoenixCrypto/PhoenixCrypto/Classes/NativeWeakRandom.swift +++ b/PhoenixCrypto/PhoenixCrypto/Classes/NativeWeakRandom.swift @@ -14,12 +14,11 @@ public class NativeWeakRandom: NSObject { private class func toByteArr(i: UInt64) -> [UInt8] { let count = MemoryLayout.size var _i = i - let bytePtr = withUnsafePointer(to: &_i) { - $0.withMemoryRebound(to: UInt8.self, capacity: count) { - UnsafeBufferPointer(start: $0, count: count) - } + return withUnsafePointer(to: &_i) { + $0.withMemoryRebound(to: UInt8.self, capacity: count) { + [UInt8](UnsafeBufferPointer(start: $0, count: count)) + } } - return [UInt8](bytePtr) } @objc