@@ -28,7 +28,7 @@ procedure vibecrypt is
28
28
" -d: decryption" & ASCII.FF & ASCII.CR &
29
29
" -r: rewrite file" & ASCII.FF & ASCII.CR &
30
30
" Example:" & ASCII.FF & ASCII.CR &
31
- " vibecrypt " & ' "' & " 0123456789abcdef" & ' "' & " test_m.txt test_c.txt -r" & ASCII.FF & ASCII.CR &
31
+ " vibecrypt " & ' "' & " 0123456789abcdef" & ' "' & " -e test_m.txt test_c.txt -r" & ASCII.FF & ASCII.CR &
32
32
" The key can contain one of the characters:" & ASCII.FF & ASCII.CR &
33
33
" ' ', '!', '" & ' "' & " ', '#', '$', '%', '&'," & ASCII.FF & ASCII.CR &
34
34
" ''', '(', ')', '*', '+', ',', '-', '.', '/', '0'," & ASCII.FF & ASCII.CR &
@@ -57,16 +57,17 @@ begin
57
57
elsif Ada.Command_Line.Argument(1 )'length >= 16 then
58
58
password := Ada.Command_Line.Argument(1 )(1 ..16 );
59
59
else
60
- for i in Ada.Command_Line.Argument(1 )'length..16 loop
60
+ password(1 ..Ada.Command_Line.Argument(1 )'length) := Ada.Command_Line.Argument(1 );
61
+ for i in (Ada.Command_Line.Argument(1 )'length + 1 )..16 loop
61
62
password(i) := character'val(character'pos(' ' ) + i);
62
63
end loop ;
63
64
end if ;
64
65
for i in 1 ..16 loop
66
+ ada.text_io.put_line(" " & password(i));
65
67
if password(i) not in ' ' ..' ~' then
66
68
Ada.text_io.put_line(" The key contains an invalid character" );
67
69
system.os_lib.os_exit(0 );
68
70
end if ;
69
- password(i) := Ada.Command_Line.Argument(1 )(i);
70
71
end loop ;
71
72
72
73
file_crypter.init_key(password);
@@ -113,4 +114,4 @@ begin
113
114
exception
114
115
when Error: others =>
115
116
Ada.Text_IO.Put_Line(" Error: " & Ada.Exceptions.Exception_Message(Error));
116
- end vibecrypt ;
117
+ end vibecrypt ;
0 commit comments