Skip to content

Commit 8968848

Browse files
author
Andrey Fil
authored
Update vibecrypt.adb
1 parent a366797 commit 8968848

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

vibecrypt.adb

+5-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ procedure vibecrypt is
2828
" -d: decryption" & ASCII.FF & ASCII.CR &
2929
" -r: rewrite file" & ASCII.FF & ASCII.CR &
3030
"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 &
3232
"The key can contain one of the characters:" & ASCII.FF & ASCII.CR &
3333
" ' ', '!', '" & '"' & "', '#', '$', '%', '&'," & ASCII.FF & ASCII.CR &
3434
" ''', '(', ')', '*', '+', ',', '-', '.', '/', '0'," & ASCII.FF & ASCII.CR &
@@ -57,16 +57,17 @@ begin
5757
elsif Ada.Command_Line.Argument(1)'length >= 16 then
5858
password := Ada.Command_Line.Argument(1)(1..16);
5959
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
6162
password(i) := character'val(character'pos(' ') + i);
6263
end loop;
6364
end if;
6465
for i in 1..16 loop
66+
ada.text_io.put_line(" " & password(i));
6567
if password(i) not in ' '..'~' then
6668
Ada.text_io.put_line("The key contains an invalid character");
6769
system.os_lib.os_exit(0);
6870
end if;
69-
password(i) := Ada.Command_Line.Argument(1)(i);
7071
end loop;
7172

7273
file_crypter.init_key(password);
@@ -113,4 +114,4 @@ begin
113114
exception
114115
when Error: others =>
115116
Ada.Text_IO.Put_Line("Error: " & Ada.Exceptions.Exception_Message(Error));
116-
end vibecrypt;
117+
end vibecrypt;

0 commit comments

Comments
 (0)