libutil

C Utility Library
git clone http://git.omkov.net/libutil
Log | Tree | Refs | README | LICENCE | Download

AuthorJamozed <[email protected]>
Date2021-01-26 04:31:54
Commitae5acb7e62b376c050bba728ddea258160460cd9
Parente4b2536eeaceed6b73e5898afa2bce4413931e67

crypt: Rename the misc component to crypt

Diffstat

M CMakeLists.txt | 3 ++-
M README.md | 2 +-
R src/lib/misc.h -> src/lib/crypt.h | 8 +++++++-
R src/test_misc.c -> src/test_crypt.c | 6 +++---

4 files changed, 13 insertions, 6 deletions

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9436d8..752ade5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@ ADD_LIBRARY(lib STATIC ${LIBSRC})
 
 LINK_LIBRARIES(lib)
 
+ADD_EXECUTABLE(test_crypt  ${PROJECT_SOURCE_DIR}/src/test_crypt.c)
 ADD_EXECUTABLE(test_endian ${PROJECT_SOURCE_DIR}/src/test_endian.c)
 ADD_EXECUTABLE(test_error  ${PROJECT_SOURCE_DIR}/src/test_error.c)
-ADD_EXECUTABLE(test_misc   ${PROJECT_SOURCE_DIR}/src/test_misc.c)
 ADD_EXECUTABLE(test_optget ${PROJECT_SOURCE_DIR}/src/test_optget.c)
diff --git a/README.md b/README.md
index e4906f6..8e4b96f 100644
--- a/README.md
+++ b/README.md
@@ -8,10 +8,10 @@ OMKOV lib is a lightweight generic library to be included locally in projects.
 
 | Component        | Description                                         |
 | ---------------- | --------------------------------------------------- |
+| crypt            | Cryptography functions                              |
 | endian           | Endianness related functions                        |
 | error            | Error reporting functions                           |
 | mode             | Parse numeric or symbolic POSIX modes               |
-| misc             | Miscellaneous functions                             |
 | optget           | Parse command line options                          |
 
 ## Build Instructions
diff --git a/src/lib/misc.h b/src/lib/crypt.h
similarity index 90%
rename from src/lib/misc.h
rename to src/lib/crypt.h
index ff25df3..3869e68 100644
--- a/src/lib/misc.h
+++ b/src/lib/crypt.h
@@ -1,5 +1,5 @@
-// misc.h, version 0.1.0
-// Misc header file for OMKOV lib
+// crypt.h, version 0.1.0
+// Crypt header file for OMKOV lib
 // Copyright (C) 2021, Jakob Wakeling
 // All rights reserved.
 
@@ -30,19 +30,21 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#ifndef OMKOV_LIB_MISC_H_RDY6J5JV
-#define OMKOV_LIB_MISC_H_RDY6J5JV
+#ifndef OMKOV_LIB_CRYPT_H_RDY6J5JV
+#define OMKOV_LIB_CRYPT_H_RDY6J5JV
 
 #include <stdint.h>
 
+/* Circular shift left */
 #define ROL8(x, n)   (uint8_t)(((x) << (n)) | ((x) >>  (8 - (n))))
 #define ROL16(x, n) (uint16_t)(((x) << (n)) | ((x) >> (16 - (n))))
 #define ROL32(x, n) (uint32_t)(((x) << (n)) | ((x) >> (32 - (n))))
 #define ROL64(x, n) (uint64_t)(((x) << (n)) | ((x) >> (64 - (n))))
 
+/* Circular shift right */
 #define ROR8(x, n)   (uint8_t)(((x) >> (n)) | ((x) <<  (8 - (n))))
 #define ROR16(x, n) (uint16_t)(((x) >> (n)) | ((x) << (16 - (n))))
 #define ROR32(x, n) (uint32_t)(((x) >> (n)) | ((x) << (32 - (n))))
 #define ROR64(x, n) (uint64_t)(((x) >> (n)) | ((x) << (64 - (n))))
 
-#endif // OMKOV_LIB_MISC_H_RDY6J5JV
+#endif // OMKOV_LIB_CRYPT_H_RDY6J5JV
diff --git a/src/test_misc.c b/src/test_crypt.c
similarity index 96%
rename from src/test_misc.c
rename to src/test_crypt.c
index 4825aa3..1b99cef 100644
--- a/src/test_misc.c
+++ b/src/test_crypt.c
@@ -1,5 +1,5 @@
-// test_misc.c
-// Misc unit test for OMKOV lib
+// test_crypt.c
+// Crypt unit test for OMKOV lib
 // Copyright (C) 2021, Jakob Wakeling
 // All rights reserved.
 
@@ -17,7 +17,7 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "lib/misc.h"
+#include "lib/crypt.h"
 #include "unit.h"
 
 #include <stdint.h>