MBMessageDigest Class Reference
Inherits from | NSObject |
---|---|
Declared in | MBMessageDigest.h |
Overview
Provides a mechanism for computing secure one-way hashes from various data sources.
For convenience, extensions are provided for the NSString
and NSData
classes allowing message digests to be computed on such instances directly.
See NSString(MBMessageDigest)
and NSData(MBMessageDigest)
for details.
Creating MD5 message digests
+ MD5DataForString:
Computes an MD5 hash given an input string.
+ (nonnull NSData *)MD5DataForString:(nonnull NSString *)src
Parameters
src |
the string for which the MD5 will be computed |
---|
Return Value
the MD5 hash, as binary NSData
Declared In
MBMessageDigest.h
+ MD5ForString:
Computes an MD5 hash given an input string.
+ (nonnull NSString *)MD5ForString:(nonnull NSString *)src
Parameters
src |
the string for which the MD5 will be computed |
---|
Return Value
the MD5 hash, as a lowercase hexadecimal string
Declared In
MBMessageDigest.h
+ MD5ForData:
Computes an MD5 hash from an NSData
instance.
+ (nonnull NSString *)MD5ForData:(nonnull NSData *)src
Parameters
src |
the data for which the MD5 will be computed |
---|
Return Value
the MD5 hash, as a lowercase hexadecimal string
Declared In
MBMessageDigest.h
+ MD5ForBytes:length:
Computes an MD5 hash from an array of bytes.
+ (nonnull NSString *)MD5ForBytes:(nonnull const void *)bytes length:(size_t)len
Parameters
bytes |
the byte array for which the MD5 will be computed |
---|---|
len |
the length of the byte array |
Return Value
the MD5 hash, as a lowercase hexadecimal string
Declared In
MBMessageDigest.h
+ MD5ForFileAtPath:error:
Computes an MD5 hash for the contents of a file.
+ (nullable NSString *)MD5ForFileAtPath:(nonnull NSString *)path error:(NSErrorPtrPtr)errPtr
Parameters
path |
the filesystem path of the file for which the MD5 will be computed |
---|---|
errPtr |
If an error occurs and this parameter is non- |
Return Value
the MD5 hash, as a lowercase hexadecimal string; if an error
occurs while attempting to read the file, nil
is returned
Declared In
MBMessageDigest.h
+ MD5ForFileAtPath:
Computes an MD5 hash for the contents of a file.
+ (nullable NSString *)MD5ForFileAtPath:(nonnull NSString *)path
Parameters
path |
the filesystem path of the file for which the MD5 will be computed |
---|
Return Value
the MD5 hash, as a lowercase hexadecimal string; if an error
occurs while attempting to read the file, nil
is returned
Declared In
MBMessageDigest.h
Creating SHA-1 message digests
+ SHA1DataForString:
Computes an SHA-1 hash given an input string.
+ (nonnull NSData *)SHA1DataForString:(nonnull NSString *)src
Parameters
src |
the string for which the SHA-1 will be computed |
---|
Return Value
the SHA-1 hash, as binary NSData
Declared In
MBMessageDigest.h
+ SHA1ForString:
Computes an SHA-1 hash given an input string.
+ (nonnull NSString *)SHA1ForString:(nonnull NSString *)src
Parameters
src |
the string for which the SHA-1 will be computed |
---|
Return Value
the SHA-1 hash, as a lowercase hexadecimal string
Declared In
MBMessageDigest.h
+ SHA1ForData:
Computes an SHA-1 hash from an NSData
instance.
+ (nonnull NSString *)SHA1ForData:(nonnull NSData *)src
Parameters
src |
the data for which the SHA-1 will be computed |
---|
Return Value
the SHA-1 hash, as a lowercase hexadecimal string
Declared In
MBMessageDigest.h
+ SHA1ForBytes:length:
Computes an SHA-1 hash from an array of bytes.
+ (nonnull NSString *)SHA1ForBytes:(nonnull const void *)bytes length:(size_t)len
Parameters
bytes |
the byte array for which the SHA-1 will be computed |
---|---|
len |
the length of the byte array |
Return Value
the SHA-1 hash, as a lowercase hexadecimal string
Declared In
MBMessageDigest.h
+ SHA1ForFileAtPath:error:
Computes an SHA-1 hash for the contents of a file.
+ (nullable NSString *)SHA1ForFileAtPath:(nonnull NSString *)path error:(NSErrorPtrPtr)errPtr
Parameters
path |
the filesystem path of the file for which the SHA-1 will be computed |
---|---|
errPtr |
If an error occurs and this parameter is non- |
Return Value
the SHA-1 hash, as a lowercase hexadecimal string; if an error
occurs while attempting to read the file, nil
is returned
Declared In
MBMessageDigest.h
+ SHA1ForFileAtPath:
Computes an SHA-1 hash for the contents of a file.
+ (nullable NSString *)SHA1ForFileAtPath:(nonnull NSString *)path
Parameters
path |
the filesystem path of the file for which the SHA-1 will be computed |
---|
Return Value
the SHA-1 hash, as a lowercase hexadecimal string; if an error
occurs while attempting to read the file, nil
is returned
Declared In
MBMessageDigest.h