Skip to content

Commit

Permalink
fixup! Add native entropy for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bast committed Apr 22, 2021
1 parent b469710 commit 51277be
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions PhoenixCrypto/PhoenixCrypto/Classes/NativeWeakRandom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ public class NativeWeakRandom: NSObject {
private class func toByteArr(i: UInt64) -> [UInt8] {
let count = MemoryLayout<UInt64>.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
Expand Down

0 comments on commit 51277be

Please sign in to comment.