You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4 KiB

  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. #import <Foundation/Foundation.h>
  15. /**
  16. * Returns a SHA1 Hash of the input NSData
  17. */
  18. NSString *FIRCLSHashNSData(NSData *data);
  19. /**
  20. * Returns a SHA256 Hash of the input NSData
  21. */
  22. NSString *FIRCLS256HashNSData(NSData *data);
  23. /**
  24. * Returns a SHA1 Hash of the input bytes
  25. */
  26. NSString *FIRCLSHashBytes(const void *bytes, size_t length);
  27. /**
  28. * Populates a Hex value conversion of value into outputBuffer.
  29. * If value is nil, then outputBuffer is not modified.
  30. */
  31. void FIRCLSSafeHexToString(const uint8_t *value, size_t length, char *outputBuffer);
  32. /**
  33. * Iterates through the raw bytes of NSData in a way that is similar to
  34. * -[NSData enumerateByteRangesUsingBlock:], but is safe to call from older
  35. * OSes that do not support it.
  36. */
  37. void FIRCLSEnumerateByteRangesOfNSDataUsingBlock(
  38. NSData *data, void (^block)(const void *bytes, NSRange byteRange, BOOL *stop));