DTS Application Library  0.2.3
Application library containing referenced objects and interfaces to common libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Utilities commonly used. More...

#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/evp.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <openssl/rand.h>
#include <openssl/md5.h>
#include <openssl/sha.h>
#include <ctype.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/time.h>
#include "include/dtsapp.h"

Go to the source code of this file.

Functions

void seedrand (void)
 Seed openssl random number generator. More...
 
int genrand (void *buf, int len)
 Generate random sequence. More...
 
void sha512sum2 (unsigned char *buff, const void *data, unsigned long len, const void *data2, unsigned long len2)
 Calculate the SHA2-512 hash accross 2 data chunks. More...
 
void sha512sum (unsigned char *buff, const void *data, unsigned long len)
 Calculate the SHA2-512 hash. More...
 
void sha256sum2 (unsigned char *buff, const void *data, unsigned long len, const void *data2, unsigned long len2)
 Calculate the SHA2-256 hash accross 2 data chunks. More...
 
void sha256sum (unsigned char *buff, const void *data, unsigned long len)
 Calculate the SHA2-256 hash. More...
 
void sha1sum2 (unsigned char *buff, const void *data, unsigned long len, const void *data2, unsigned long len2)
 Calculate the SHA1 hash accross 2 data chunks. More...
 
void sha1sum (unsigned char *buff, const void *data, unsigned long len)
 Calculate the SHA1 hash. More...
 
void md5sum2 (unsigned char *buff, const void *data, unsigned long len, const void *data2, unsigned long len2)
 Calculate the MD5 hash accross 2 data chunks. More...
 
void md5sum (unsigned char *buff, const void *data, unsigned long len)
 Calculate the MD5 hash. More...
 
int md5cmp (unsigned char *digest1, unsigned char *digest2)
 Compare two md5 hashes. More...
 
int sha1cmp (unsigned char *digest1, unsigned char *digest2)
 Compare two SHA1 hashes. More...
 
int sha256cmp (unsigned char *digest1, unsigned char *digest2)
 Compare two SHA2-256 hashes. More...
 
int sha512cmp (unsigned char *digest1, unsigned char *digest2)
 Compare two SHA2-512 hashes. More...
 
void md5hmac (unsigned char *buff, const void *data, unsigned long len, const void *key, unsigned long klen)
 Hash Message Authentication Codes (HMAC) MD5. More...
 
void sha1hmac (unsigned char *buff, const void *data, unsigned long len, const void *key, unsigned long klen)
 Hash Message Authentication Codes (HMAC) SHA1. More...
 
void sha256hmac (unsigned char *buff, const void *data, unsigned long len, const void *key, unsigned long klen)
 Hash Message Authentication Codes (HMAC) SHA2-256. More...
 
void sha512hmac (unsigned char *buff, const void *data, unsigned long len, const void *key, unsigned long klen)
 Hash Message Authentication Codes (HMAC) SHA2-512. More...
 
int strlenzero (const char *str)
 Check if a string is zero length. More...
 
char * ltrim (char *str)
 Trim white space at the begining of a string. More...
 
char * rtrim (const char *str)
 Trim white space at the end of a string. More...
 
char * trim (const char *str)
 Trim whitesapce from the beggining and end of a string. More...
 
uint64_t tvtontp64 (struct timeval *tv)
 Convert a timeval struct to 64bit NTP time. More...
 
uint16_t checksum (const void *data, int len)
 Obtain the checksum for a buffer. More...
 
uint16_t checksum_add (const uint16_t checksum, const void *data, int len)
 Obtain the checksum for a buffer adding a checksum. More...
 
uint16_t verifysum (const void *data, int len, const uint16_t check)
 Verify a checksum. More...
 
void touch (const char *filename, uid_t user, gid_t group)
 Create a file and set user and group. More...
 
char * b64enc_buf (const char *message, uint32_t len, int nonl)
 Base 64 encode a buffer. More...
 
char * b64enc (const char *message, int nonl)
 Base 64 encode a string. More...
 

Detailed Description

Utilities commonly used.

Definition in file util.c.