tree checksum vpatch file split hunks

all signers: phf

antecedents: vtools_vpatch_newline

press order:

vtools_genesisphf
vdiff_fixes_newline_gccphf
keccakphf
vdiff_keccakphf
vtools_fixes_bitrate_char_arrayphf
vtools_vpatchphf
vtools_fixes_static_tohexphf
vtools_vpatch_newlinephf
vtools_ksumphf

patch:

-
+ 134FD11107C54B29987B07535A29ACE30B0AB066C929988A973C15ACFB7340A02DD812F21E5CE104482C432590029F58EFD78C58E50E9FA561C4E788D973EA0B
vtools/ksum.gpr
(0 . 0)(1 . 7)
5 project Ksum is
6 for Languages use ("Ada");
7 for Source_Dirs use ("src");
8 for Object_Dir use "obj";
9 for Exec_Dir use ".";
10 for Main use ("ksum.adb");
11 end Ksum;
- 46F4DCEB24634A095A5AE2E5993D41AE1D12EC92275E4DBC83DD6737E3512FB2608C2065B0307EDDFBAC4D3E0782EDC9DFB3CA74A94962630AD7482E09B1096D
+ BB7B5CB38AD1749D191B26362C637E55B9ABC4A4B689885ECECC5C7EEA142D86EF56278874B665BB0C14F73819F2857E33F888BCFDC2BDE3F3401F241FA566A4
vtools/manifest
(6 . 3)(6 . 4)
16 514700 phf vtools_vpatch Initial vpatch tool implementation in Ada.
17 517100 phf vtools_fixes_static_tohex Fixes for xalloc's use of static inline courtesy of spyked, fix broken ToHex implementation
18 517100 phf vtools_vpatch_newline Vpatch tool support for "No newline at end of file" directive.
19 543200 phf vtools_ksum Ksum standalone keccak hasher
-
+ 4A973D255432BC899FB3DFE8AB16F5A9A29578FD141DBC501083CFDE8D9C42F8D037D778B5DF1458B9EA86623EF675DB876EF38C9792C3FDB1834F55B4FEC248
vtools/src/ksum.adb
(0 . 0)(1 . 69)
24 with Ada.Command_Line; use Ada.Command_Line;
25 with Ada.Directories;use Ada.Directories;
26 with Ada.Exceptions;
27 with Ada.Io_Exceptions;
28 with Ada.Sequential_IO;
29 with Ada.Text_IO; use Ada.Text_IO;
30 with Bits; use Bits;
31 with Interfaces; use Interfaces;
32 with SMG_Keccak; use SMG_Keccak;
33 with Character_IO; use Character_IO;
34 procedure Ksum is
35 Buffer_Size: constant Natural := 2048;
36 Hash_Size: constant Natural := 64;
37 Byte_Size: constant Natural := 8;
38
39 package CIO renames Character_IO.Character_IO;
40 Fs: File_Size;
41 File: CIO.File_Type;
42 Ctx: Keccak_Context(Block_Len=>Default_Bitrate);
43 Buf: String(1..Buffer_Size);
44 B: Bitstream(1..Buf'Length*Byte_Size);
45
46 function Read_Buffer return Integer is
47 C: Character;
48 begin
49 for I in 1..Buf'Length loop
50 CIO.Read(File, C);
51 Buf(I):=C;
52 if End_Of_File(File) then
53 return I;
54 end if;
55 end loop;
56 return Buf'Length;
57 end Read_Buffer;
58
59 begin
60 for Arg in 1..Argument_Count loop
61 declare
62 Filename: String:=Argument(Arg);
63 begin
64 Fs:=Size(Filename);
65 Character_IO.Open(File, CIO.In_File, Filename);
66 declare
67 O: Bitstream(1..Hash_Size*Byte_Size);
68 N: Integer;
69 begin
70 KeccakBegin(Ctx);
71 Read_Loop:
72 loop
73 exit Read_Loop when End_Of_File(File);
74 N := Read_Buffer;
75 ToBitstream(Buf(1..N), B(1..N*Byte_Size));
76 KeccakHash(Ctx, B(1..N*Byte_Size));
77 end loop Read_Loop;
78 KeccakEnd(Ctx, O);
79 declare
80 Hex: String := ToHex(O);
81 begin
82 Put(Hex); Put(" "); Put_Line(Filename);
83 end;
84 end;
85 Character_IO.Close(File);
86 exception
87 when The_Error : others =>
88 Put(Standard_Error, Filename); Put(": ");
89 Put_Line(Ada.Exceptions.Exception_Message(The_Error));
90 end;
91 end loop;
92 end;