소스 검색

Merge pull request #472 from lgalabru/feature/exposing-uint8-bits

Exposing very useful atomic extensions (bits, chunks, ...)
Marcin Krzyzanowski 8 년 전
부모
커밋
cf75e33f63
3개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 1
      Sources/CryptoSwift/Array+Extension.swift
  2. 1 1
      Sources/CryptoSwift/Bit.swift
  3. 2 2
      Sources/CryptoSwift/UInt8+Extension.swift

+ 1 - 1
Sources/CryptoSwift/Array+Extension.swift

@@ -16,7 +16,7 @@ extension Array {
 extension Array {
 
     /** split in chunks with given chunk size */
-    func chunks(size chunksize: Int) -> Array<Array<Element>> {
+    public func chunks(size chunksize: Int) -> Array<Array<Element>> {
         var words = Array<Array<Element>>()
         words.reserveCapacity(self.count / chunksize)
         for idx in stride(from: chunksize, through: self.count, by: chunksize) {

+ 1 - 1
Sources/CryptoSwift/Bit.swift

@@ -6,7 +6,7 @@
 //  Copyright © 2016 Marcin Krzyzanowski. All rights reserved.
 //
 
-enum Bit: Int {
+public enum Bit: Int {
     case zero
     case one
 }

+ 2 - 2
Sources/CryptoSwift/UInt8+Extension.swift

@@ -43,7 +43,7 @@ extension UInt8 {
     }
 
     /** array of bits */
-    func bits() -> [Bit] {
+    public func bits() -> [Bit] {
         let totalBitsCount = MemoryLayout<UInt8>.size * 8
 
         var bitsArray = [Bit](repeating: Bit.zero, count: totalBitsCount)
@@ -59,7 +59,7 @@ extension UInt8 {
         return bitsArray
     }
 
-    func bits() -> String {
+    public func bits() -> String {
         var s = String()
         let arr: [Bit] = self.bits()
         for idx in arr.indices {