-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpkcs1_v1_5.cairo
53 lines (52 loc) · 1.91 KB
/
pkcs1_v1_5.cairo
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
from starkware.cairo.common.uint256 import Uint256
from uint1024 import Uint1024
from uint2048 import Uint2048
from uint512 import Uint512
// https://github.com/dlitz/pycrypto/blob/v2.7a1/lib/Crypto/Signature/PKCS1_v1_5.py#L173
func pkcs_expected_hash(headers_hash: Uint256) -> Uint2048 {
return (
Uint2048(
low=Uint1024(
low=Uint512(
low=headers_hash,
high=Uint256(
low=0x0d060960864801650304020105000420,
high=0xFFFFFFFFFFFFFFFFFFFFFFFF00303130,
),
),
high=Uint512(
low=Uint256(
low=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
high=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
),
high=Uint256(
low=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
high=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
),
),
),
high=Uint1024(
low=Uint512(
low=Uint256(
low=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
high=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
),
high=Uint256(
low=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
high=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
),
),
high=Uint512(
low=Uint256(
low=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
high=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
),
high=Uint256(
low=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
high=0x0001FFFFFFFFFFFFFFFFFFFFFFFFFFFF,
),
),
),
)
);
}