- 680EFB9458A976F700A689A6B0678510172945E94D35207F07BEA280BB87B30EDC889968FBF6C922C8CC5C79B9193986AB66037CC36F47D52B49E91826C22FE4
+ 252A6F237724580F4AF2F1FBF2DFF39DCDD7C1A14AC7C17021D4ED0D0939F6394BF2CBCE3E2ECC3261B8474ECF0D7DE34728467679E557A7C44BAD510D070747
vtools/src/keccak_c.adb
(54 . 28)(54 . 41)
13 end C_Begin;
14
15 procedure C_Hash(Ctx: in C_Context_Access;
16 Input: Interfaces.C.Char_Array;
17 Len: Interfaces.C.Size_T) is
18 Input: Char_Star;
19 Len: Interfaces.C.size_t) is
20 L: Natural := Natural(Len);
21 S: String(1..L);
22 B: Bitstream(1..S'Length*8);
23 Ptr: Char_Star := Input;
24 begin
25 Interfaces.C.To_Ada(Input, S, L, Trim_Nul => False);
26 if Input = null then
27 raise C.Strings.Dereference_Error;
28 end if;
29 for Chr of S loop
30 Chr := Character(Ptr.all);
31 Char_Ptrs.Increment(Ptr);
32 end loop;
33 ToBitstream(S, B);
34 KeccakHash(Ctx.all, B);
35 end C_Hash;
36
37 procedure C_End(Ctx: C_Context_Access;
38 Output: out Interfaces.C.Char_Array;
39 Output: Char_Star;
40 Len: Interfaces.C.Size_T) is
41 L: Natural := Natural(Len);
42 S: String(1..L);
43 B: Bitstream(1..S'Length*8);
44 Count: Interfaces.C.Size_T;
45 Ptr: Char_Star := Output;
46 begin
47 if Output = null then
48 raise C.Strings.Dereference_Error;
49 end if;
50 KeccakEnd(Ctx.all, B);
51 ToString(B, S);
52 Interfaces.C.To_C(S, Output(0..Len), Count, Append_Nul => False);
53 for Chr of S loop
54 Ptr.all := Interfaces.C.char(Chr);
55 Char_Ptrs.Increment(Ptr);
56 end loop;
57 -- Len = Count
58 end C_End;
59