| 1 | 
           efrain | 
           1 | 
           // Copyright 2019 Google
  | 
        
        
            | 
            | 
           2 | 
           //
  | 
        
        
            | 
            | 
           3 | 
           // Licensed under the Apache License, Version 2.0 (the "License");
  | 
        
        
            | 
            | 
           4 | 
           // you may not use this file except in compliance with the License.
  | 
        
        
            | 
            | 
           5 | 
           // You may obtain a copy of the License at
  | 
        
        
            | 
            | 
           6 | 
           //
  | 
        
        
            | 
            | 
           7 | 
           //      http://www.apache.org/licenses/LICENSE-2.0
  | 
        
        
            | 
            | 
           8 | 
           //
  | 
        
        
            | 
            | 
           9 | 
           // Unless required by applicable law or agreed to in writing, software
  | 
        
        
            | 
            | 
           10 | 
           // distributed under the License is distributed on an "AS IS" BASIS,
  | 
        
        
            | 
            | 
           11 | 
           // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  | 
        
        
            | 
            | 
           12 | 
           // See the License for the specific language governing permissions and
  | 
        
        
            | 
            | 
           13 | 
           // limitations under the License.
  | 
        
        
            | 
            | 
           14 | 
              | 
        
        
            | 
            | 
           15 | 
           #import <Foundation/Foundation.h>
  | 
        
        
            | 
            | 
           16 | 
              | 
        
        
            | 
            | 
           17 | 
           /**
  | 
        
        
            | 
            | 
           18 | 
            * Returns a SHA1 Hash of the input `Data`
  | 
        
        
            | 
            | 
           19 | 
            */
  | 
        
        
            | 
            | 
           20 | 
           NSString *FIRCLSHashNSData(NSData *data);
  | 
        
        
            | 
            | 
           21 | 
           /**
  | 
        
        
            | 
            | 
           22 | 
            * Returns a SHA256 Hash of the input `Data`
  | 
        
        
            | 
            | 
           23 | 
            */
  | 
        
        
            | 
            | 
           24 | 
           NSString *FIRCLS256HashNSData(NSData *data);
  | 
        
        
            | 
            | 
           25 | 
           /**
  | 
        
        
            | 
            | 
           26 | 
            * Returns a SHA1 Hash of the input bytes
  | 
        
        
            | 
            | 
           27 | 
            */
  | 
        
        
            | 
            | 
           28 | 
           NSString *FIRCLSHashBytes(const void *bytes, size_t length);
  | 
        
        
            | 
            | 
           29 | 
           /**
  | 
        
        
            | 
            | 
           30 | 
            * Populates a Hex value conversion of value into outputBuffer.
  | 
        
        
            | 
            | 
           31 | 
            * If value is nil, then outputBuffer is not modified.
  | 
        
        
            | 
            | 
           32 | 
            */
  | 
        
        
            | 
            | 
           33 | 
           void FIRCLSSafeHexToString(const uint8_t *value, size_t length, char *outputBuffer);
  | 
        
        
            | 
            | 
           34 | 
              | 
        
        
            | 
            | 
           35 | 
           /**
  | 
        
        
            | 
            | 
           36 | 
            * Iterates through the raw bytes of data in a way that is similar to
  | 
        
        
            | 
            | 
           37 | 
            * `Data`'s `enumerateBytes(_ block:)`, but is safe to call from older
  | 
        
        
            | 
            | 
           38 | 
            * OSes that do not support it.
  | 
        
        
            | 
            | 
           39 | 
            */
  | 
        
        
            | 
            | 
           40 | 
           void FIRCLSEnumerateByteRangesOfNSDataUsingBlock(
  | 
        
        
            | 
            | 
           41 | 
               NSData *data, void (^block)(const void *bytes, NSRange byteRange, BOOL *stop));
  |