DTMK is a single, small and lightweight module that contains many useful functions like encryption, compression, hashing, encoding, file splitting/merging and etc.
DTMK supports various features that every developer needs
DTMK runs on all the windows versions with no c runtime dependency, it has a small self-contained runtime.
DTMK provieds best and most modern algorithms on the market and they will be updated on each build with the state-of-art technologies.
DTMK library provides a very easy to use security tools like encryption, hashing and encoding.
DTMK library provides a very easy to use data tools like compression, chunking, reading and writing.
DTMK is very small and fast, it has very small memory overhead and leaves no footprint in memory.
Also it supports multi-threading!
We will update DTMK features daily, weekly and monthly, you can request features in github repo here.
Here is a complete list of current DevToolsMasterKit APIs
bool initialize_kit();
Initializes Kit and Toolset, Must be called at the entrypoint of your program.
void encryption_aes256_set_key_and_iv(unsigned char* _key);
Sets cipher key and iv, _key size must be 48 : first 32 bytes as key and last 16 bytes as iv.
void encryption_aes256_encrypt_buffer(void* dataPtr, size_t dataSize, void* outVectorPtr);
Encrypts given buffer and return the data as a std::vector, to use this function on managed and non c++ languages you must use buffering_create_native_buffer api to create a native buffer and pass it to the function.
void encryption_aes256_decrypt_buffer(void* dataPtr, size_t dataSize, void* outVectorPtr);
Decrypts given buffer and return the data as a std::vector, to use this function on managed and non c++ languages you must use buffering_create_native_buffer api to create a native buffer and pass it to the function.
void encryption_aes256_cbc_set_key_and_iv(unsigned char* _key);
Sets cipher key and iv, _key size must be 48 : first 32 bytes as key and last 16 bytes as iv.
void encryption_aes256_cbc_encrypt_buffer(void* dataPtr, size_t dataSize);
Encrypts given buffer by its pointer and size, this function is useful for direct buffer encryption without a secondary buffer, it's recommended to add 16 bytes padding to the start and 16 padding bytes to end of your buffer.
void encryption_aes256_cbc_decrypt_buffer(void* dataPtr, size_t dataSize);
Decrypts given buffer by its pointer and size, this function is useful for direct buffer encryption without a secondary buffer, it's recommended to add 16 bytes padding to the start and 16 padding bytes to end of your buffer.
void encryption_xor_buffer(void* bufferPtr, size_t bufferSize);
Encrypts/Decrypts given buffer using xor technique using default key.
void encryption_xor_buffer_with_key(void* bufferPtr, size_t bufferSize, char* keyPtr, int keySize);
Encrypts/Decrypts given buffer using xor technique by a custom key, key can be at any size.
void compression_deflate_compress_buffer(void* dataPtr, size_t dataSize, void* outVectorPtr);
Compress given buffer and return the data as a std::vector, to use this function on managed and non c++ languages you must use buffering_create_native_buffer api to create a native buffer and pass it to the function.
void compression_deflate_decompress_buffer(void* dataPtr, size_t dataSize, void* outVectorPtr);
Decompress given buffer and return the data as a std::vector, to use this function on managed and non c++ languages you must use buffering_create_native_buffer api to create a native buffer and pass it to the function.
void* compression_lzma2_compress_buffer(void* dataPtr, size_t dataSize);
Compress given buffer by its pointer and size, this function is useful for direct buffer compression without a secondary buffer, LZMA2 has a high ratio compression algorithm, returned buffer is uint8_t* and must be freed manually.
void* compression_lzma2_decompress_buffer(void* dataPtr, size_t dataSize);
Decompress given buffer by its pointer and size, this function is useful for direct buffer compression without a secondary buffer, returned buffer is uint8_t* and must be freed manually.
float compression_calculate_ratio(size_t inputSize, size_t postSize);
Calculates compression ratio based on before/after size of buffers, it returns ratio from 0% to 100%.
char* hashing_convert_hash_to_string(DTMK::hash_buffer* hashPtr, size_t hashSize)
Convert hash_buffer to string version, returned buffer is char* and must be freed manually.
hash_buffer* hashing_sha256_hash_buffer(void* dataPtr, size_t dataSize);
Hashes given buffer by its pointer and size using sha256 algorithm. returned buffer is uint8_t* and must be freed manually.
hash_buffer* hashing_sha512_hash_buffer(void* dataPtr, size_t dataSize);
Hashes given buffer by its pointer and size using sha512 algorithm. returned buffer is uint8_t* and must be freed manually.
hash_buffer* hashing_md5_hash_buffer(void* dataPtr, size_t dataSize);
Hashes given buffer by its pointer and size using md5 algorithm. returned buffer is uint8_t* and must be freed manually.
char* encoding_base64_encode_buffer(void* dataPtr, size_t dataSize);
Encode buffer to base64 string, returned buffer is char* and must be freed manually.
void* encoding_base64_decode_buffer(char* b64Data, int& dataSize);
Decode base64 string to buffer, returned buffer is uint8_t* and must be freed manually.
file_buffer buffering_read_from_file(const char* inputFile);
Read a file from disk to a file_buffer which contains pointer to data and data size, data must be freed manually using data pointer.
void buffering_write_to_file(void* bufferPtr, size_t bufferSize, const char* outputFile);
Write a buffer to the file on disk.
void buffering_split_file_to_chunks(const char* inputFile, size_t chucnkSize);
Splits a file to chunks by specific chunk size, result will be like filename.part_001, filename.part_002, filename.part_003 and so on...
void buffering_split_file_to_chunks_by_count(const char* inputFile, int chunkNumber);
Splits a file to chunks by specific chunk number, result will be like filename.part_001, filename.part_002, filename.part_003and so on...
void buffering_merge_named_chunks_to_file(const char* inputFile, const char* outputFile);
Merges file chunks to a single file automatically by chunks name. input file name should be without numbers and it should contain .part_###
void buffering_merge_chunks_to_file(const char** chunks, int chunkNumber, const char* outputFile);
Merges file chunks to a single file using a name list and chunk numbers.
void* buffering_create_native_buffer(size_t bufferSize);
Creates a native buffer and allocates it by given size, return pointer is a std::vector,
void buffering_resize_native_buffer(void* buffer, size_t bufferSize);
Resizes a native buffer by given size, buffer is a pointer is a std::vector.
void* buffering_get_buffer_ptr(void* buffer);
Returns pointer to buffer data which is uint8_t*, buffer is a pointer is a std::vector.
size_t buffering_get_buffer_size(void* buffer);
Returns raw size of the buffer, buffer is a pointer is a std::vector.
void buffering_free_buffer(void* buffer);
Frees the memory a native buffer allocated, buffer is a pointer is a std::vector.
void buffering_delete_buffer(void* buffer);
Deletes a native buffer by its pointer, buffer is a pointer is a std::vector.
NOTE : You must use
buffering_delete_bufferonly on the buffers created bybuffering_create_native_buffer.
int memory_scan_for_fixed_pattern(void* bufferPtr, size_t bufferSize, void* patternBuffer, size_t patternSize);
Searches a buffer to find a fixed pattern, if return value be -1 it means pattern is not found in the given buffer.
void debugging_print_buffer(void* buffer, size_t size, const char* bufferName, int lineBreak);
Prints out a buffer as hex bytes in the console.
DevToolsMasterKit (DTMKLib) is licensed under creative commons 1.0 Universal
Share And Use :
You are free to copy and redistribute the material in any medium or format for any purpose, even commercially.
Credit/Attribution Free :
You
don't need to provide any information or credit to the developer.
No Derivatives :
If you remix, transform, or build upon the material, you may not distribute the modified material.
No Additional Restrictions :
You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
DevToolsMasterKit by DiMarKTeKt is marked with CC0 1.0 Universal