API guide for the BaroCRYPT solution for lightweight and fastest cryptographic algorithms(MySQL, MariaDB)
Index
1. BaroCRYPT
1.1 BaroCRYPT Overview
1.2 BaroCRYPT Features/Benefits
2. BaroCRYPT Integration API
2.1 Integration API configuration
2.2 Integration API functions
3. Create/Use/Delete function
3.1 Create funtion
3.2 Use function
3.3 Delete function
4. About BaroCRYPT
1. BaroCRYPT
1.1 BaroCRYPT Overview
The BaroCRYPT solution is a lightweight and fastest encryption algorithm based on the XXTEA (Extended Extended Tiny Encryption Algorithm), a compact and easy-to-implement block encryption algorithm using the Feistel cipher.

1.2 BaroCRYPT Features/Benefits
Based on the XXTEA (aka Corrected Block TEA) encryption algorithm, the BaroCRYPT solution is an optimal solution capable of quickly encrypting and decrypting data even under extreme constraints such as legacy hardware systems (embedded) with a minimum amount of usable RAM. Is as follows.
■ It is a small and easy-to-implement block encryption algorithm based on the Feistel cipher, which is small in size, fast and easy to implement.
■ It is a small-sized algorithm based on the Feistel cipher, and has high encryption strength compared to its size.
■ Although the size of the algorithm is small, it is the fastest and safest algorithm in
existence.
■ Compared to other block encryption algorithms, it is easy to implement, easy to apply to environments with large hardware specification constraints, and freely used.
■ It is a block encryption algorithm that encrypts 64 bits (8 bytes) and uses a 128 bit (16 byte)
key.
■ Corrected Block TEA (XXTEA) is a block cipher algorithm originally designed to correct the
weakness of Block TEA
■ Provides free customizing and convenience of interlocking development with various application
programs. (API integration in Java and C languages)
■ TO_ENCRYPTS (encryption) and TO_DECRYPTS (decryption) functions are provided for easy use in SQL statements.
※ What is a Feistel Cipher?
It is a repetitive block cipher in which the ciphertext is encrypted from the plaintext while repeating the same substitution and substitution. It is a cipher similar to the Data Encryption Standard (DES). The other halves do an exclusive OR (XOR) and then swap each other. Do this process in the same pattern for each permutation, but do not exchange each other in the last permutation. The subkey used during encryption is reversed during decryption.
2. BaroCRYPT Integration API
2.1 Integration API configuration
Dynamic linking library related to BaroCRYPT is used to encrypt and decrypt data.
| API Class | Description | Etc |
| libbaroudf.so | BaroCRYPT dll for MySQL/MariaDB |
2.2 Integration API functions
1) TO_ENCRYPTS function
- NAME
TO_ENCRYPTS
- SYNOPSIS
void * TO_ENCRYPTS(const void * data)
- DESCRIPTION
A function that encrypts data.
data: data to encrypt
- RETURN VALUES
return encrypted data
2) TO_DECRYPTS function
- NAME
TO_DECRYPTS
- SYNOPSIS
void * TO_DECRYPTS(const void * data)
- DESCRIPTION
A function to decrypt data.
data: data to decrypt
- RETURN VALUES
Return the decrypted data
3. Create/Use/Delete functions
3.1 Create function
MySQL/MariaDB's UDF (User Defined Function) is used when calling an external program written in C or C++ in MySQL/MariaDB or sending data.
It must be written in C or C++, and the operating system must support dynamic loading.
Copy the attached files (libbaroudf.so) to the directory with the following command result in mysql shell.
| Mysql> SHOW VARIABLES LIKE 'plugin_dir'; +---------------+----------------------------+ | Variable_name | Value | +---------------+----------------------------+ | plugin_dir | /usr/lib64/mariadb/plugin/ | +---------------+----------------------------+ 1 row in set (0.002 sec) |
To create the TO_ENCRYPTS, TP_DECRYPTS functions, execute the following commands in mysql shell.
| MariaDB> create function TO_ENCRYPTS returns string soname 'libbaroudf.so'; MariaDB> create function TO_DECRYPTS returns string soname 'libbaroudf.so'; |
3.2 Use function
To use the TO_ENCRYPTS, and TP_DECRYPTS functions, execute the following commands in mysql shell.
| MariaDB> select * from func; +-------------+-----+---------------+----------+ | name | ret | dl | type | +-------------+-----+---------------+----------+ | TO_DECRYPTS | 0 | libbaroudf.so | function | | TO_ENCRYPTS | 0 | libbaroudf.so | function | +-------------+-----+---------------+----------+ 2 rows in set (0.00 sec) MariaDB> select TO_ENCRYPTS('I am Tom'); +-------------------------+ | TO_ENCRYPTS('I am Tom') | +-------------------------+ | W11HfaAAnMZDKuUe | +-------------------------+ 1 row in set (0.00 sec) MariaDB> select TO_DECRYPTS('W11HfaAAnMZDKuUe'); +---------------------------------+ | TO_DECRYPTS('W11HfaAAnMZDKuUe') | +---------------------------------+ | I am Tom | +---------------------------------+ 1 row in set (0.00 sec) |
3.3 Delete function
To delete the TO_ENCRYPTS, and TP_DECRYPTS functions, execute the following command in mysql shell.
| MariaDB> drop function if exists TO_ENCRYPTS; MariaDB> drop function if exists TO_DECRYPTS; |
4. About BaroCRYPT

Version 1.0 - Official Release - 2016.12.1
Copyright ⓒ Nurit corp. All rights reserved.
Company: Nurit Co., Ltd.
Registration Number: 258-87-00901
CEO: Jongil Lee
Tel: +82-2-2665-0119(Technical support, sales inquiry)
email: mc529@nurit.co.kr
Address: #913, 15, Magokjungang 2-ro, Gangseo-gu, Seoul (Magok-dong, Magok Techno Tower 2)
'▶ BaroSolution > 가이드' 카테고리의 다른 글
| BaroCRYPT integration Guide(PostgreSQL) (0) | 2023.08.25 |
|---|---|
| BaroCRYPT integration Guide(Oracle,Tibero) (0) | 2023.08.24 |
| BaroPAM Solution Installation Summary(Mac OS X) (0) | 2023.08.22 |
| BaroPAM Solution Installation Summary (Linux) (0) | 2023.08.22 |
| BaroPAM Solution Integration Summary (Java) (0) | 2023.08.21 |