-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
75 lines (64 loc) · 5.33 KB
/
main.cpp
File metadata and controls
75 lines (64 loc) · 5.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* This file is part of the CryptoLib256 library.
* Developed (D) 2021/2022 by Wayne Michael Thornton aka WMT.
*
* Distributed under the Public Benefit Zero Copyright License (v.1.0)
*
* You should have received a copy of the Public Benefit Zero Copyright License
* along with this program. If not, see <https://github.com/wmthornton/PBZC.git>.
*/
// DEMO FILE ** DEMO FILE ** DEMO FILE ** DEMO FILE ** DEMO FILE ** DEMO FILE ** //
#include "CryptoLib256/CryptoLib256.h" // A precompiled header file is included which speeds up compilation. This file is called CryptoLib256.h.gch
int main(){
SHA256_ENCRYPT::u8 output[32]; // Generate an empty 32 byte output array
SHA256_ENCRYPT::u8 input[32] = {
0x66,0xd5,0x4e,0x28,0x5f,0xff,0x6b,0x59,0xac,0x3b,0x34,0x14,0xb5,0x3c,0xb2,0xc6,
0xa4,0x85,0x1e,0x0d,0x86,0xc7,0x4f,0xbb,0x75,0x5e,0xcb,0xc3,0x6e,0x48,0x79,0x8f}; // Generate a 32 byte input array. U8 is a typedef for unsigned char.
SHA256_ENCRYPT::u32 diffusion[32] = {
0xf26cb481,0x16a5dc92,0x3c5ba924,0x79b65248,0x2fc64b18,0x615acd29,0xc3b59a42,0x976b2584,
0x6cf281b4,0xa51692dc,0x5b3c24a9,0xb6794852,0xc62f184b,0x5a6129cd,0xb5c3429a,0x6b978425,
0xb481f26c,0xdc9216a5,0xa9243c5b,0x524879b6,0x4b182fc6,0xcd29615a,0x9a42c3b5,0x2584976b,
0x81b46cf2,0x92dca516,0x24a95b3c,0x4852b679,0x184bc62f,0x29cd5a61,0x429ab5c3,0x84256b97}; // Generate a 32 byte diffusion array. U32 is a typedef for unsigned int.
SHA256_ENCRYPT::u8 confusion[512] {
0xac,0xd1,0x25,0x94,0x1f,0xb3,0x33,0x28,0x7c,0x2b,0x17,0xbc,0xf6,0xb0,0x55,0x5d,
0x8f,0xd2,0x48,0xd4,0xd3,0x78,0x62,0x1a,0x02,0xf2,0x01,0xc9,0xaa,0xf0,0x83,0x71,
0x72,0x4b,0x6a,0xe8,0xe9,0x42,0xc0,0x53,0x63,0x66,0x13,0x4a,0xc1,0x85,0xcf,0x0c,
0x24,0x76,0xa5,0x6e,0xd7,0xa1,0xec,0xc6,0x04,0xc2,0xa2,0x5c,0x81,0x92,0x6c,0xda,
0xc6,0x86,0xba,0x4d,0x39,0xa0,0x0e,0x8c,0x8a,0xd0,0xfe,0x59,0x96,0x49,0xe6,0xea,
0x69,0x30,0x52,0x1c,0xe0,0xb2,0x05,0x9b,0x10,0x03,0xa8,0x64,0x51,0x97,0x02,0x09,
0x8e,0xad,0xf7,0x36,0x47,0xab,0xce,0x7f,0x56,0xca,0x00,0xe3,0xed,0xf1,0x38,0xd8,
0x26,0x1c,0xdc,0x35,0x91,0x43,0x2c,0x74,0xb4,0x61,0x9d,0x5e,0xe9,0x4c,0xbf,0x77,
0x16,0x1e,0x21,0x1d,0x2d,0xa9,0x95,0xb8,0xc3,0x8d,0xf8,0xdb,0x34,0xe1,0x84,0xd6,
0x0b,0x23,0x4e,0xff,0x3c,0x54,0xa7,0x78,0xa4,0x89,0x33,0x6d,0xfb,0x79,0x27,0xc4,
0xf9,0x40,0x41,0xdf,0xc5,0x82,0x93,0xdd,0xa6,0xef,0xcd,0x8d,0xa3,0xae,0x7a,0xb6,
0x2f,0xfd,0xbd,0xe5,0x98,0x66,0xf3,0x4f,0x57,0x88,0x90,0x9c,0x0a,0x50,0xe7,0x15,
0x7b,0x58,0xbc,0x07,0x68,0x3a,0x5f,0xee,0x32,0x9f,0xeb,0xcc,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a,0x62,0xdc,0x29,0x4b,0x42,0x41,
0xcb,0x2b,0xb7,0xce,0x08,0xa1,0x76,0x1d,0x1a,0xb8,0xe3,0xcc,0x7e,0x48,0x20,0xe6,
0xf8,0x45,0x93,0xde,0xc3,0x63,0x0f,0xb0,0xac,0x5c,0xba,0xdf,0x07,0x77,0xe7,0x4e,
0x1f,0x28,0x10,0x6c,0x59,0xd3,0xdd,0x2d,0x65,0x39,0xb2,0x74,0x84,0x3d,0xf4,0xbd,
0xc7,0x79,0x60,0x0b,0x4d,0x33,0x36,0x25,0xbc,0xe0,0x09,0xcf,0x5b,0xe2,0x38,0x9e,
0xc0,0xef,0xd2,0x16,0x05,0xbe,0x53,0xf7,0xc2,0xc6,0xa2,0x24,0x98,0x1c,0xad,0x04}; // Generate a 512 byte confusion array. U8 is a typedef for unsigned char.
int32_t hash_encrypt_output = SHA256_ENCRYPT::generate_hash_value(input, output, confusion, diffusion); // generate_hash_value is a function in the SHA256_ENCRYPT class.
std::string hash_output = std::to_string(hash_encrypt_output); // Convert the integer result of the generate_hash_value function to a string.
std::string input_value = "Hello World"; // The input value to be hashed.
std::string sha256_c = sha256(input_value); // Input value text is run thru the sha256 function.
std::cout << "Hash output: (Integer value generated by the 'generate_hash_value' function using input, output, confusion and diffusion variables) " << hash_output << std::endl;
std::cout << "Input result: ('Hello World' run thru sha256 algorithm) " << sha256_c << std::endl;
std::string sha256_result = sha256(hash_output + sha256_c);
std::cout << "SHA256 result: (Combination of Hash output and Input result, run thru sha256 algorithm) " << sha256_result << std::endl;
return 0;
}