-
Notifications
You must be signed in to change notification settings - Fork 12
/
DSL_utility.cpp
63 lines (49 loc) · 1.34 KB
/
DSL_utility.cpp
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
#include "snarkfront/DSL_utility.hpp"
using namespace std;
namespace snarkfront {
////////////////////////////////////////////////////////////////////////////////
// elliptic curve pairing
//
bool validPairingName(const string& name) {
return pairingBN128(name) || pairingEdwards(name);
}
bool pairingBN128(const string& name) {
return "BN128" == name;
}
bool pairingEdwards(const string& name) {
return "Edwards" == name;
}
////////////////////////////////////////////////////////////////////////////////
// SHA-2
//
bool validSHA2Name(const string& shaBits) {
return
("1" == shaBits) ||
("224" == shaBits) ||
("256" == shaBits) ||
("384" == shaBits) ||
("512" == shaBits) ||
("512_224" == shaBits) ||
("512_256" == shaBits);
}
bool validSHA2Name(const size_t shaBits) {
return
(1 == shaBits) ||
(224 == shaBits) ||
(256 == shaBits) ||
(384 == shaBits) ||
(512 == shaBits);
}
bool nameSHA256(const string& shaBits) {
return "256" == shaBits;
}
bool nameSHA512(const string& shaBits) {
return "512" == shaBits;
}
////////////////////////////////////////////////////////////////////////////////
// AES
//
bool validAESName(const size_t aesBits) {
return 128 == aesBits || 192 == aesBits || 256 == aesBits;
}
} // namespace snarkfront