123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- /*
- Software License
- Copyright (C) 2021-05-24 Xoronos
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, version 3.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
- /*
- Liabilities
- The software is provided "AS IS" without any warranty of any kind, either expressed,
- implied, or statutory, including, but not limited to, any warranty that the software
- will conform to specifications, any implied warranties of merchantability, fitness
- for a particular purpose, and freedom from infringement, and any warranty that the
- documentation will conform to the software, or any warranty that the software will
- be error free.
- In no event shall Xoronos be liable for any damages, including, but not limited to,
- direct, indirect, special or consequential damages, arising out of, resulting from,
- or in any way connected with this software, whether or not based upon warranty,
- contract, tort, or otherwise, whether or not injury was sustained by persons or
- property or otherwise, and whether or not loss was sustained from, or arose out of
- the results of, or use of, the software or services provided hereunder.
- To request the provided software under a different license you can contact us at
- support@xoronos.com
- */
- #ifndef XSETTINGS_LIB_H
- #define XSETTINGS_LIB_H
- // 16 bits
- #define XRN_ALGORITHM_VERSION 0
- // 16 bits
- #define XRN_IO_VERSION 0
- // 32 bits
- #define XRN_COMPONENT_ID 0
- // action
- #if !defined( XCOMPILEPARSER )
- #define XCOMPILEPARSER 0
- #endif
- #if !defined( XCOMPILETESTS )
- #define XCOMPILETESTS 0
- #endif
- #if !defined( XCOMPILEEXAMPLES )
- #define XCOMPILEEXAMPLES 1
- #endif
- #if !defined( XRUNCONFGEN )
- #define XRUNCONFGEN 0
- #endif
- #if !defined( XSKIPMAIN )
- #define XSKIPMAIN 0
- #endif
- #if !defined( XRN_GNU_LINUX )
- #define XRN_GNU_LINUX 1
- #endif
- #define PRINT_SETTINGS 1
- // number of bits
- #if !defined( XNBITS )
- #define XNBITS 256
- #endif
- // define function to use
- #if !defined( XUSE_BUILT_IN_INSTRUCTIONS )
- #define XUSE_BUILT_IN_INSTRUCTIONS 1
- #endif
- // DO NOT MODIFY BELOW
- // magic numbers
- #define XRN_MAGIC_NUMBER 0x22fe2022
- // define git version
- #define XRN_GIT_DIRTY_FLAG_INT (XRN_GIT_DIRTY_FLAG[0]-'0')
- #define XRN_GIT_VERSION ((uint32_t)(GIT_VERSION | ( XRN_GIT_DIRTY_FLAG_INT << 31 )))
- //define permutation
- #if ( XRUNCONFGEN == 1 )
- #include <stdint.h>
- #define XRN_PERMUTATION_NUMBER 0x00000000
- #if ( XNBITS == 256 )
- #define XRN_PERMUTATIONS { 41, 157, 187, 70, 185, 227, 64, 254, 20, 75, 53, 23, 123, 0, 84, 193, 194, 134, 138, 10, 168, 90, 211, 28, 66, 15, 230, 192, 210, 163, 131, 4, 34, 203, 132, 160, 144, 156, 91, 76, 226, 196, 222, 106, 116, 89, 43, 217, 104, 215, 55,209, 79, 95, 30, 205, 122, 228, 246, 35, 182, 244, 190, 135, 225, 158, 175, 179, 14, 170, 93, 96, 120, 115, 62, 165, 51, 60, 102, 48, 130, 129, 86, 176, 47, 68, 83, 171, 52, 218, 251, 22, 243, 250, 27, 25, 140, 169, 166, 219, 107, 174, 248, 186, 110, 94, 99, 213, 33, 87, 77, 245, 37, 235, 232, 26, 136, 13, 126, 221, 207, 61, 24, 229, 167, 59, 121, 114, 100, 212, 152, 238, 21, 50, 223, 44, 80, 199, 36, 188, 40, 201, 103, 3, 178, 220, 17, 249, 69, 253, 18, 161, 216, 240, 214, 173, 137, 153, 19, 234, 189, 72, 184, 32, 208, 81, 149, 1, 162, 127, 7, 74, 57, 2, 177, 12, 252, 241, 200, 164, 141, 239, 109, 159, 143, 45, 206, 242, 71, 49, 5, 58, 78, 101, 191, 63, 142, 113, 197, 108, 67, 119, 124, 236, 9, 11, 111, 31, 233, 145, 73, 155, 6, 42, 46, 139, 237, 38, 195, 172, 98, 247, 29, 54, 147, 202, 117, 16, 204, 39, 85, 118, 231, 224, 97, 8, 148, 154, 198, 125, 150, 92, 105, 146, 112, 65, 88, 183, 128, 181, 180, 151, 82, 255, 56, 133 };
- #elif ( XNBITS == 128 )
- #define XRN_PERMUTATIONS { 95, 47, 63, 40, 5, 0, 93, 1, 59, 107, 118, 57, 12, 117, 124, 44, 122, 100, 16, 88, 85, 4, 34, 105, 71, 113, 25, 20, 127, 81, 108, 17, 84, 13, 55, 112, 18, 38, 115, 11, 70, 75, 86, 87, 126, 123, 91, 32, 78, 24, 9, 53, 76, 7, 2, 121, 41, 83, 68, 45, 56, 103, 106, 69, 35, 10, 110, 54, 66, 60, 43, 36, 27, 120, 104, 14, 97, 37, 6, 61, 3, 46, 31, 42, 33, 82, 72, 102, 67, 49, 77, 39, 51, 98, 21, 79, 74, 26, 8, 92, 28, 65, 111, 62, 64, 29, 30, 116, 109, 19, 99, 22, 58, 101, 119, 50, 89, 90, 23, 96, 15, 80, 48, 73, 94, 52, 114, 125 };
- #endif
- static const uint8_t STD_ENC_PARAM_TABLE[] = {
- UINT8_C( 9 ), UINT8_C( 216 ), UINT8_C( 151 ), UINT8_C( 107 ), UINT8_C( 43 ), UINT8_C( 85 ),
- UINT8_C( 215 ), UINT8_C( 41 ), UINT8_C( 96 ), UINT8_C( 133 ), UINT8_C( 255 ), UINT8_C( 3 ),
- UINT8_C( 165 ), UINT8_C( 112 ), UINT8_C( 88 ), UINT8_C( 74 ), UINT8_C( 142 ), UINT8_C( 15 ),
- UINT8_C( 121 ), UINT8_C( 122 ), UINT8_C( 235 ), UINT8_C( 29 ), UINT8_C( 129 ), UINT8_C( 196 ),
- UINT8_C( 120 ), UINT8_C( 214 ), UINT8_C( 149 ), UINT8_C( 160 ), UINT8_C( 50 ), UINT8_C( 59 ),
- UINT8_C( 152 ), UINT8_C( 232 ), UINT8_C( 139 ), UINT8_C( 194 ), UINT8_C( 7 ), UINT8_C( 154 ),
- UINT8_C( 25 ), UINT8_C( 207 ), UINT8_C( 135 ), UINT8_C( 234 ), UINT8_C( 87 ), UINT8_C( 190 ),
- UINT8_C( 36 ), UINT8_C( 197 ), UINT8_C( 193 ), UINT8_C( 61 ), UINT8_C( 12 ), UINT8_C( 150 ),
- UINT8_C( 225 ), UINT8_C( 212 ), UINT8_C( 168 ), UINT8_C( 117 ), UINT8_C( 84 ), UINT8_C( 81 ),
- UINT8_C( 103 ), UINT8_C( 98 ), UINT8_C( 146 ), UINT8_C( 203 ), UINT8_C( 69 ), UINT8_C( 130 ),
- UINT8_C( 44 ), UINT8_C( 145 ), UINT8_C( 11 ), UINT8_C( 52 ), UINT8_C( 143 ), UINT8_C( 137 ),
- UINT8_C( 54 ), UINT8_C( 51 ), UINT8_C( 224 ), UINT8_C( 254 ), UINT8_C( 162 ), UINT8_C( 246 ),
- UINT8_C( 205 ), UINT8_C( 248 ), UINT8_C( 10 ), UINT8_C( 102 ), UINT8_C( 91 ), UINT8_C( 60 ),
- UINT8_C( 134 ), UINT8_C( 169 ), UINT8_C( 175 ), UINT8_C( 89 ), UINT8_C( 70 ), UINT8_C( 46 ),
- UINT8_C( 153 ), UINT8_C( 42 ), UINT8_C( 105 ), UINT8_C( 167 ), UINT8_C( 1 ), UINT8_C( 176 ),
- UINT8_C( 239 ), UINT8_C( 28 ), UINT8_C( 19 ), UINT8_C( 113 ), UINT8_C( 99 ), UINT8_C( 227 ),
- UINT8_C( 226 ), UINT8_C( 181 ), UINT8_C( 173 ), UINT8_C( 126 ), UINT8_C( 249 ), UINT8_C( 76 ),
- UINT8_C( 202 ), UINT8_C( 185 ), UINT8_C( 18 ), UINT8_C( 48 ), UINT8_C( 106 ), UINT8_C( 49 ),
- UINT8_C( 157 ), UINT8_C( 148 ), UINT8_C( 53 ), UINT8_C( 20 ), UINT8_C( 209 ), UINT8_C( 180 ),
- UINT8_C( 30 ), UINT8_C( 158 ), UINT8_C( 223 ), UINT8_C( 195 ), UINT8_C( 233 ), UINT8_C( 159 ),
- UINT8_C( 22 ), UINT8_C( 198 ), UINT8_C( 208 ), UINT8_C( 100 ), UINT8_C( 33 ), UINT8_C( 183 ),
- UINT8_C( 125 ), UINT8_C( 115 ), UINT8_C( 131 ), UINT8_C( 132 ), UINT8_C( 178 ), UINT8_C( 191 ),
- UINT8_C( 250 ), UINT8_C( 177 ), UINT8_C( 79 ), UINT8_C( 171 ), UINT8_C( 72 ), UINT8_C( 57 ),
- UINT8_C( 242 ), UINT8_C( 247 ), UINT8_C( 155 ), UINT8_C( 13 ), UINT8_C( 186 ), UINT8_C( 170 ),
- UINT8_C( 14 ), UINT8_C( 65 ), UINT8_C( 109 ), UINT8_C( 66 ), UINT8_C( 219 ), UINT8_C( 73 ),
- UINT8_C( 75 ), UINT8_C( 199 ), UINT8_C( 237 ), UINT8_C( 9 ), UINT8_C( 8 ), UINT8_C( 27 ),
- UINT8_C( 101 ), UINT8_C( 47 ), UINT8_C( 241 ), UINT8_C( 92 ), UINT8_C( 128 ), UINT8_C( 144 ),
- UINT8_C( 83 ), UINT8_C( 93 ), UINT8_C( 222 ), UINT8_C( 243 ), UINT8_C( 231 ), UINT8_C( 140 ),
- UINT8_C( 97 ), UINT8_C( 166 ), UINT8_C( 221 ), UINT8_C( 45 ), UINT8_C( 38 ), UINT8_C( 204 ),
- UINT8_C( 40 ), UINT8_C( 123 ), UINT8_C( 39 ), UINT8_C( 37 ), UINT8_C( 141 ), UINT8_C( 24 ),
- UINT8_C( 251 ), UINT8_C( 210 ), UINT8_C( 217 ), UINT8_C( 172 ), UINT8_C( 108 ), UINT8_C( 21 ),
- UINT8_C( 244 ), UINT8_C( 63 ), UINT8_C( 62 ), UINT8_C( 230 ), UINT8_C( 187 ), UINT8_C( 245 ),
- UINT8_C( 184 ), UINT8_C( 192 ), UINT8_C( 116 ), UINT8_C( 127 ), UINT8_C( 206 ), UINT8_C( 200 ),
- UINT8_C( 80 ), UINT8_C( 238 ), UINT8_C( 163 ), UINT8_C( 118 ), UINT8_C( 211 ), UINT8_C( 147 ),
- UINT8_C( 26 ), UINT8_C( 114 ), UINT8_C( 23 ), UINT8_C( 94 ), UINT8_C( 82 ), UINT8_C( 77 ),
- UINT8_C( 64 ), UINT8_C( 189 ), UINT8_C( 119 ), UINT8_C( 236 ), UINT8_C( 4 ), UINT8_C( 218 ),
- UINT8_C( 188 ), UINT8_C( 161 ), UINT8_C( 228 ), UINT8_C( 34 ), UINT8_C( 16 ), UINT8_C( 17 ),
- UINT8_C( 138 ), UINT8_C( 124 ), UINT8_C( 156 ), UINT8_C( 252 ), UINT8_C( 71 ), UINT8_C( 6 ),
- UINT8_C( 229 ), UINT8_C( 95 ), UINT8_C( 2 ), UINT8_C( 111 ), UINT8_C( 90 ), UINT8_C( 31 ),
- UINT8_C( 78 ), UINT8_C( 32 ), UINT8_C( 104 ), UINT8_C( 220 ), UINT8_C( 174 ), UINT8_C( 35 ),
- UINT8_C( 110 ), UINT8_C( 164 ), UINT8_C( 58 ), UINT8_C( 56 ), UINT8_C( 182 ), UINT8_C( 86 ),
- UINT8_C( 68 ), UINT8_C( 55 ), UINT8_C( 201 ), UINT8_C( 136 ), UINT8_C( 253 ), UINT8_C( 240 ),
- UINT8_C( 179 ), UINT8_C( 67 ), UINT8_C( 5 ), UINT8_C( 213 )
- };
- static const uint32_t STD_ENC_PARAM_CNT[] = {
- UINT32_C( 338688665 ), UINT32_C( 3337861206 ), UINT32_C( 3468740409 ), UINT32_C( 3335515952 ),
- UINT32_C( 3947386749 ), UINT32_C( 3474824703 ), UINT32_C( 367420878 ), UINT32_C( 853996506 )
- };
- #endif
- #if ( XRUNCONFGEN == 0 )
- #include "default_permutation_settings.h"
- #include "default_encoding_settings.h"
- #endif
- #define XRN_LIB_VERSION ((( XRN_ALGORITHM_VERSION & 0x0000ffff ) << 16 ) | ( XRN_IO_VERSION & 0x0000ffff))
- #if XRN_GNU_LINUX == 0
- #if !defined( _WIN32 )
- #define _WIN32
- #endif
- #endif
- // include headers
- #if XRN_GNU_LINUX == 0
- #include <windows.h>
- #include <process.h>
- #include <bcrypt.h>
- #endif
- // define architecture
- #if !defined( XRN_ARC )
- #define XRN_ARC
- #if (( XNBITS == 256 ) || ( XNBITS == 128 ))
- #define XARC64BIT 1
- #define XARC32BIT 0
- #define XARC16BIT 0
- #define XARC08BIT 0
- #elif ( XNBITS == 64 )
- #define XARC64BIT 0
- #define XARC32BIT 1
- #define XARC16BIT 0
- #define XARC08BIT 0
- #elif ( XNBITS == 32 )
- #define XARC64BIT 0
- #define XARC32BIT 0
- #define XARC16BIT 1
- #define XARC08BIT 0
- #elif ( XNBITS == 16 )
- #define XARC64BIT 0
- #define XARC32BIT 0
- #define XARC16BIT 0
- #define XARC08BIT 1
- #endif
- #endif
- #define XNBYTES_ORIGIN (( XNBITS*XNBITS - ((XNBITS-1)*(XNBITS))/2) / 8 ) - 1
- #endif
|