interfaz
Last change
on this file was
25a5325,
checked in by lhernandez <lhernandez@…>, 8 years ago
|
Realizada mejora de la interfaz(grid), agragada funcionalidad para la creacion de llaves (privada y publica) se guardar en un directorio kyes del proyecto, agragada funcionalidad para el cifrado de un texto plano (por ahora esta comentado, para realizar la interfaz) y agragada funcionalidad para descifrar el archivo a partir de un data.dat cifrado
|
-
Property mode set to
100644
|
File size:
799 bytes
|
Line | |
---|
1 | #pragma once |
---|
2 | |
---|
3 | #include <stdint.h> |
---|
4 | #include <cstring> |
---|
5 | #include <initializer_list> |
---|
6 | |
---|
7 | |
---|
8 | union block512_t { |
---|
9 | uint8_t x8[64]; |
---|
10 | uint64_t x64[8]; |
---|
11 | block512_t(){} |
---|
12 | block512_t(const std::initializer_list<uint64_t> &x) { |
---|
13 | if (x.size() < 8) { |
---|
14 | memset(this, 0, sizeof(block512_t)); |
---|
15 | } |
---|
16 | auto it = x.begin(); |
---|
17 | size_t i = 0, size = x.size(); |
---|
18 | while (i < size) { |
---|
19 | x64[i] = *it; |
---|
20 | ++it; ++i; |
---|
21 | } |
---|
22 | } |
---|
23 | block512_t(uint8_t x) { |
---|
24 | for (int i = 0; i < 64; ++i) x8[i] = x; |
---|
25 | } |
---|
26 | bool operator==(const block512_t &x) const { |
---|
27 | for (int i = 0; i < 8; ++i) { |
---|
28 | if (x64[i] != x.x64[i]) { |
---|
29 | return false; |
---|
30 | } |
---|
31 | } |
---|
32 | return true; |
---|
33 | } |
---|
34 | }; |
---|
35 | |
---|
36 | enum hash_mode_t |
---|
37 | { |
---|
38 | hm512, hm256 |
---|
39 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.