group
group__libshare__memkey
Utility functions to generate unique checksums of data.
ShareKey Hash Digest
typedef struct shkey_t shkey_t
typedef uint32_t sh160_t[5]
A 160-bit key.
shkey_t* shkey_bin
(char *data, size_t data_len)
Generates a unique 192-bit key from a segment of data.
Note
Algorythm is a combination of adler32 and sha256.
shkey_t* ashkey_bin
(char *data, size_t data_len)
shkey_t* shkey_str
(char *kvalue)
Create a hashmap key reference from The string to generate into a .
shkey_t
structshkey__t
compound
kvalue
shkey_t
structshkey__t
compound
kvalue
Return Value
A referencing a kvalue
shkey_t
structshkey__t
compound
shkey_t* shkey_num
(long kvalue)
Create a hashmap key reference from a 32bit number.
shkey_t
structshkey__t
compound
The number to generate into a
kvalue
shkey_t
structshkey__t
compound
Return Value
A statically allocated version of
shkey_t* shkey_num64
(uint64_t kvalue)
Create a hashmap key reference from a 64bit number.
shkey_t
structshkey__t
compound
The number to generate into a
kvalue
shkey_t
structshkey__t
compound
Return Value
A statically allocated version of
shkey_t* shkey_uniq
(void)
Create a unique hashmap key reference.
shkey_t
structshkey__t
compound
Return Value
A containing a unique key value.
shkey_t
structshkey__t
compound
shkey_t* ashkey_uniq
(void)
uint64_t shkey_crc
(shkey_t *key)
A 64-bit numeric representation of a .
shkey_t
structshkey__t
compound
void shkey_free
(shkey_t **key_p)
shkey_t* shkey_xor
(shkey_t *key1, shkey_t *key2)
shkey_t* ashkey_xor
(shkey_t *key1, shkey_t *key2)
shkey_t* shkey_dup
(shkey_t *key)
const char* shkey_print
(shkey_t *key)
A ascii string representation of a libshare key.
Note
The string returned will be 36 characters long in a format similar to base64.
shkey_t* ashkey_str
(char *name)
Generates a from a string that does not need to be freed.
shkey_t
structshkey__t
compound
Bug
psuedo thread-safe
bug_1_bug000001
shkey_t* ashkey_num
(long num)
Generates a from a number that does not need to be freed.
shkey_t
structshkey__t
compound
Bug
psuedo thread-safe
bug_1_bug000002
int shkey_cmp
(shkey_t *key_1, shkey_t *key_2)
Compare two shkek_t key tokens.
Return Value
TRUE is keys are ientical and FALSE if not.
shkey_t* shkey_clone
(shkey_t *key)
shkey_t* shkey_cert
(shkey_t *key, uint64_t crc, shtime_t stamp)
Creates a certificate's signature key based off content attributes.
int shkey_verify
(shkey_t *sig, uint64_t crc, shkey_t *key, shtime_t stamp)
Verifies whether content attributes match a generated certificate signature key.
shkey_t* shkey_gen
(char *hex_str)
Converts a hex string into a binary key.
const char* shkey_hex
(shkey_t *key)
A string hexadecimal representation of a libshare key.
Note
The string returned will be 48 characters long.
shkey_t* shkey_hexgen
(char *hex_str)
Generate a libshare key from a 48-character long hexadecimal string.
shkey_t* shkey_shr160
(sh160_t raw)
Generate a allocated share-key from a 160bit binary segment.
shkey_t* ashkey_shr160
(sh160_t raw)
Generate a share-key on the stack from a 160bit binary segment.
Note
Do not free the return value.
void sh160_key
(shkey_t *in_key, sh160_t u160)
Obtain a 160bit binary segment from a pre-set 160-bit share-key.
void shkey_shr160_hash
(shkey_t *ret_key, unsigned char *data, size_t data_len)
Generate a SHA256+RIPEMD160 20-byte hash in the form of a share-key.
shkey_t* shkey_shr160_gen
(char *key_str)
Generate a 'u160' key from a printed key string.
char* shkey_shr160_print
(shkey_t *key)
int shkey_shr160_ver
(shkey_t *key)
int shr224
(unsigned char *data, size_t data_len, unsigned char *ret_digest)
int shr224_init
(shr224_t *ctx)
int shr224_write
(shr224_t *ctx, unsigned char *data, size_t data_len)
int shr224_result
(shr224_t *ctx, unsigned char *ret_digest)
int shr224_hmac
(unsigned char *key, size_t key_len, unsigned char *data, size_t data_len, unsigned char *ret_digest)
int shr224_hmac_init
(shr224_t *ctx, unsigned char *key, size_t key_len)
int shr224_hmac_write
(shr224_t *ctx, unsigned char *data, size_t data_len)
int shr224_hmac_result
(shr224_t *ctx, unsigned char *ret_digest)
int shr224_expand
(unsigned char *digest, unsigned char *data, size_t data_len)
int shr224_shrink
(uint64_t crc, unsigned char *data, size_t data_len, unsigned char *ret_digest)
uint64_t shr224_crc
(shr224_t *ctx)
shkey_t* ashkey_shr224
(void *data, size_t data_len)
shkey_t* shkey_shr224
(void *data, size_t data_len)
int shkey_shr224_ver
(shkey_t *key, unsigned char *data, size_t data_len)
int shr224_result_key
(shr224_t *ctx, shkey_t *key)
uint64_t shr224_result_crc
(shr224_t *ctx, shkey_t *key)
void* memxor
(void *dest, const void *src, size_t n)
int shkey_alg
(shkey_t *key)
void shkey_alg_set
(shkey_t *key, int alg)
SHKEY_WORDS
7
The maximum word size of the share key.
SHR224_BLOCK_SIZE
(SHR224_BLOCKS * sizeof(uint64_t))
SHR224_IPAD_MAGIC
(uint8_t)SHMEM8_MAGIC
SHR224_OPAD_MAGIC
(uint8_t)~SHMEM8_MAGIC
ashkey_blank
(( *)&_shkey_blank)structshkey__tcompoundshkey_t
Generates a blank key token.
shkey_t
structshkey__t
compound
Return Value
A statically allocated blank key token.
Note
Do not free the returned value.
shkey_is_blank
(0 == memcmp((_key), &_shkey_blank, sizeof()))structshkey__tcompoundshkey_t
Determines whether a has been initialized.
shkey_t
structshkey__t
compound
Return Value
FALSE is key is not blank, and TRUE is the key is blank.
Note
It is possible to generate keys which equal a blank key, for example a key generated from a zero-length data segment. This macro should be utilitized only when it is known that the key being compared against has a unique value.