openssl_sha1.h File Reference
#include "magma_setup.h"Data Structures | |
| struct | magma_sha1_t |
Defines | |
| #define | READCHUNK 1024 |
| #define | KEY_MOVEMENT_SLEEP_TIME 1 |
| #define | SHA_DIGEST_LENGTH 20 |
| #define | decrement_key(key) decrement_key_p(key, key + 2*SHA_DIGEST_LENGTH - 1) |
| #define | increment_key(key) increment_key_p(key, key + 2*SHA_DIGEST_LENGTH - 1) |
Functions | |
| unsigned char * | sha1_data (const void *data, unsigned int length) |
| unsigned char * | sha1_fd (int fd) |
| char * | armour_hash (const unsigned char *hash) |
| int | increment_key_p (char *key, char *p) |
| int | decrement_key_p (char *key, char *p) |
| long int | key_difference (char *k1, char *k2) |
| char * | key_difference_by_char (char *max, char *min) |
| magma_sha1_t * | sha1_aton (char *key) |
| char * | subtract_key (char *k1, char *k2) |
| int | get_char_val (char c) |
| char | get_int_val (int i) |
Define Documentation
| #define decrement_key | ( | key | ) | decrement_key_p(key, key + 2*SHA_DIGEST_LENGTH - 1) |
decrement a key by 1 unit
| #define increment_key | ( | key | ) | increment_key_p(key, key + 2*SHA_DIGEST_LENGTH - 1) |
increment a key by 1 unit
| #define KEY_MOVEMENT_SLEEP_TIME 1 |
sleep time between two key movements
| #define READCHUNK 1024 |
read buffer dimension
| #define SHA_DIGEST_LENGTH 20 |
Function Documentation
| char* armour_hash | ( | const unsigned char * | hash | ) |
provides printable (armoured) hash bucked
- Parameters:
-
hash the binary hash value to be armoured
- Returns:
- pointer to armoured hash
| int decrement_key_p | ( | char * | key, | |
| char * | p | |||
| ) |
decrement key value by one. returns 1 if key has been decremented, 0 otherwise (tipically if key is already all zero). Should never be called directly: always use macro decrement_key(key)!
- Parameters:
-
key buffer holding armoured key p used internally for recursive operations
- Returns:
- 1 on success, 0 otherwise
| int get_char_val | ( | char | c | ) |
transform hexadecimal character into its integer value
- Parameters:
-
c given hexadecimal character
- Returns:
- numeric integer value of c
| char get_int_val | ( | int | i | ) |
transform an integer value to hexadecimal rappresentation
- Parameters:
-
i integer given value
- Returns:
- ASCII rappresentation
| int increment_key_p | ( | char * | key, | |
| char * | p | |||
| ) |
increment key value by one. returns 1 if key has been incremented, 0 otherwise (tipically if key is already all 0xf). Should never be called directly: always use macro increment_key(key)!
- Parameters:
-
key buffer holding armoured key p used internally for recursive operations
- Returns:
- 1 on success, 0 otherwise
| long int key_difference | ( | char * | k1, | |
| char * | k2 | |||
| ) |
return difference between two keys.
- Parameters:
-
k1 pointer to first key k2 pointer to second key
- Returns:
- integer difference between the keys
| char* key_difference_by_char | ( | char * | max, | |
| char * | min | |||
| ) |
calculate difference between two keys
- Parameters:
-
max first key, supposed to be the greater min second key, supposed to be the smallest
- Returns:
- pointer to a key which is the difference. memory is dynamically allocated and should be freed by outside code.
- Todo:
- unused code to be removed?
| magma_sha1_t* sha1_aton | ( | char * | key | ) |
transform ASCII key rappresentation to numeric rappresentation
- Parameters:
-
key pointer to given key
- Returns:
- numeric rappresentation of key, NULL if something went wrong
| unsigned char* sha1_data | ( | const void * | data, | |
| unsigned int | length | |||
| ) |
return hash bucket of buffered data
- Parameters:
-
data memory location of given data length size of memory buffer *data
- Returns:
- binary hashing of given data
| unsigned char* sha1_fd | ( | int | fd | ) |
return hash bucked of an open filedescriptor
- Parameters:
-
fd file descriptor open on data file
- Returns:
- binary hashing of given data
| char* subtract_key | ( | char * | k1, | |
| char * | k2 | |||
| ) |
make the difference of two keys
- Parameters:
-
k1 pointer to first key k2 pointer to second key
- Returns:
- pointer to difference key, NULL if something went wrong