JubeatPlus 3.9.11
Loading...
Searching...
No Matches
Crypto Class Reference

Four CommonCrypto wrappers. More...

#include <Crypto.h>

Inheritance diagram for Crypto:
Collaboration diagram for Crypto:

Class Methods

(nonnull NSData *) + createHash:
 SHA-1 of a data buffer, returned as the raw twenty-byte digest.
(nonnull NSString *) + sha1:
 SHA-1 of a string, returned as forty lower-case hexadecimal characters.
(nonnull NSString *) + sha256:
 SHA-256 of a string, returned as sixty-four lower-case hexadecimal characters.
(nullable NSData *) + cryptorToData:value:key:
 AES-128 encrypt or decrypt with PKCS#7 padding and no initialisation vector.

Detailed Description

Four CommonCrypto wrappers.

Method Documentation

◆ createHash:

+ (nonnull NSData *) createHash: (nullable NSData *) data

SHA-1 of a data buffer, returned as the raw twenty-byte digest.

The only one of the three digest methods that takes data rather than a string, and the only one whose length handling is correct.

Parameters
dataThe bytes to hash.
Returns
The digest, twenty bytes.
Ghidra address:
0x266a44

◆ cryptorToData:value:key:

+ (nullable NSData *) cryptorToData: (unsigned int) cryptor
value: (nullable NSData *) value
key: (nullable NSData *) key 

AES-128 encrypt or decrypt with PKCS#7 padding and no initialisation vector.

The key length is fixed at sixteen bytes whatever key actually holds, so a shorter key reads past its own buffer and a longer one is silently truncated. Running with no IV means ECB mode, so identical plaintext blocks produce identical ciphertext.

Parameters
cryptorkCCEncrypt or kCCDecrypt.
valueThe bytes to transform.
keyThe key. Must be at least sixteen bytes.
Returns
The result, or nil when CommonCrypto reports a failure.
Ghidra address:
0x266e24

◆ sha1:

+ (nonnull NSString *) sha1: (nullable NSString *) string

SHA-1 of a string, returned as forty lower-case hexadecimal characters.

Mis-measures non-ASCII input. It takes the string's UTF-8 C string but its character count from -length, so any string containing a character outside ASCII is hashed over the wrong number of bytes. See TYPES_PENDING.md.

Parameters
stringThe text to hash.
Returns
The digest in hexadecimal.
Ghidra address:
0x266b14

◆ sha256:

+ (nonnull NSString *) sha256: (nullable NSString *) string

SHA-256 of a string, returned as sixty-four lower-case hexadecimal characters.

Carries the same length mismatch as +sha1: .

Parameters
stringThe text to hash.
Returns
The digest in hexadecimal.
Ghidra address:
0x266c9c

The documentation for this class was generated from the following file: