summaryrefslogtreecommitdiff
path: root/src/core/utilities.h
blob: ee2c6eb7733e49b2f7ffdafb08cc19bc820e880a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* BSD-2-Clause license
 * 
 * Copyright (c) 2018-2023 NST <www.newinfosec.ru>, sss <sss at dark-alexandr dot net>. 
 * 
 */

#pragma once

/* check if destination path is regular file */
bool is_regular_file(const char *path);

/* check if destination path is directory */
bool is_directory(const char *path);

/* calculate sha1 hash of src */
bool sha1(uint8_t *dst, const uint8_t *src, size_t src_length);

/* print hex representation of buf to stdout */
void hex_print(const uint8_t *buf, size_t buf_len);

/* get one random ascii character */
char random_ascii_character();

/* get random string of ascii characters with length of 'len'
 * and store intopointed buffer */
char *random_ascii_string(char *buf, const size_t buf_size);

void random_bytes(uint8_t *buf, size_t buf_len);