docs
This commit is contained in:
parent
07f7a5f6dc
commit
12e23b30f6
@ -57,28 +57,28 @@ void _file_read_error(void) {
|
|||||||
puts("\033[1mvipre-cryptor: \033[91mFile read error!\033[0m");
|
puts("\033[1mvipre-cryptor: \033[91mFile read error!\033[0m");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DATA_RAND_MAX (ULONG_MAX / 2)
|
#define DATA_RAND_MAX (ULLONG_MAX / 2)
|
||||||
|
|
||||||
static unsigned long int next = 1;
|
static unsigned long long int next = 1;
|
||||||
|
|
||||||
int _str_rand(void)
|
int _str_rand(void)
|
||||||
{
|
{
|
||||||
next = next * 1103515245 + 12345;
|
next = next * 1103515245 + 12345;
|
||||||
return (unsigned long)(next/65536) % (DATA_RAND_MAX + 1);
|
return (unsigned long long)(next/65536) % (DATA_RAND_MAX + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _str_srand(unsigned long seed)
|
void _str_srand(unsigned long long seed)
|
||||||
{
|
{
|
||||||
next = seed;
|
next = seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long __generate_hash(char* str) {
|
unsigned long long __generate_hash(char* str) {
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
unsigned long ret = 0;
|
unsigned long long ret = 0;
|
||||||
size_t max = strlen(str);
|
size_t max = strlen(str);
|
||||||
while (pos < max) {
|
while (pos < max) {
|
||||||
ret += (unsigned char)str[pos];
|
ret += (unsigned char)str[pos];
|
||||||
if (ret > (unsigned long)ULONG_MAX - 10) ret = 32;
|
if (ret > (unsigned long long)ULLONG_MAX - 10) ret = 32;
|
||||||
pos ++;
|
pos ++;
|
||||||
}
|
}
|
||||||
if (ret == 0) ret ++;
|
if (ret == 0) ret ++;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user