Latest 1.3
Homepage https://github.com/chris-huxtable/CBHDigestKit
License ISC
Platforms osx 10.8, requires ARC
Authors

release
pod
licence
coverage

Makes calculating digests easy.

Supports:

  • SHA-224
  • SHA-256
  • SHA-386
  • SHA-512
  • SHA-1
  • MD2
  • MD4
  • MD5

Use

CBHDigestKit extends NSData and NSString with a category adding methods for several digests and converting from bytesToHex.

Example:

Compute the SHA-256 digest of a NSString:

NSData *digest = [@"This is a string." sha256UsingEncoding:NSUTF8StringEncoding];

Compute the SHA-256 digest of a NSData:

NSData *digest = [[NSData dataWithContentsOfFile:@"/etc/hosts"] sha256];

Efficently compute the SHA-256 digest of a file:

NSData *digest = [CBHDigester digestStream:[NSInputStream inputStreamWithFileAtPath:@"/etc/hosts"];

Compute and print a digest using an arbitrary algorithm:

CBHDigestAlgorithm algorithm = ...
NSData *data = [NSData dataWithContentsOfFile:@"/etc/hosts"];
NSData *digest = [data digestUsingAlgorithm:algorithm];
NSLog(@"0x%@", [digest bytesToHex]);

Licence

CBHDigestKit is available under the ISC license.

Latest podspec

{
    "name": "CBHDigestKit",
    "version": "1.3",
    "module_name": "CBHDigestKit",
    "summary": "Makes calculating digests easy.",
    "homepage": "https://github.com/chris-huxtable/CBHDigestKit",
    "license": {
        "type": "ISC",
        "file": "LICENSE"
    },
    "authors": {
        "Chris Huxtable": "[email protected]"
    },
    "social_media_url": "https://twitter.com/@Chris_Huxtable",
    "platforms": {
        "osx": "10.8"
    },
    "source": {
        "git": "https://github.com/chris-huxtable/CBHDigestKit.git",
        "tag": "v1.3"
    },
    "requires_arc": true,
    "public_header_files": "CBHDigestKit/**/*.h",
    "source_files": "CBHDigestKit/**/*.{h,m}"
}

Pin It on Pinterest

Share This