Description
When encrypting 1600 "A" everything runs ok but after 1629 of "A" this message "deck after step 4 of keystream...." is put out. Subsequent input of "A" would be consequently encryptet as "L" plus the error-message mentioned above.
When the deck is changed into:
`#deck_original=(C_A C_2 C_3 C_4 C_5 C_6 C_7 C_8 C_9 C_10 C_J C_Q C_K D_A D_2 D_3 D_4 D_5 D_6 D_7 D_8 D_9 D_10 D_J D_Q D_K H_A H_2 H_3 H_4 H_5 H_6 H_7 H_8 H_9 H_10 H_J H_Q H_K S_A S_2 S_3 S_4 S_5 S_6 S_7 S_8 S_9 S_10 S_J S_Q S_K A_Joker B_Joker)
#deck=(C_A C_2 C_3 C_4 C_5 C_6 C_7 C_8 C_9 C_10 C_J C_Q C_K D_A D_2 D_3 D_4 D_5 D_6 D_7 D_8 D_9 D_10 D_J D_Q D_K H_A H_2 H_3 H_4 H_5 H_6 H_7 H_8 H_9 H_10 H_J H_Q H_K S_A S_2 S_3 S_4 S_5 S_6 S_7 S_8 S_9 S_10 S_J S_Q S_K A_Joker B_Joker)
#Alt_deck
deck_original=(S_A S_4 C_K S_J H_A H_Q C_5 C_3 S_6 D_J C_9 D_2 H_9 H_3 C_Q S_10 H_5 D_K C_7 H_10 S_K H_K D_10 S_3 H_4 C_4 C_A D_6 H_8 H_6 S_9 H_J S_8 S_2 D_5 D_4 S_5 D_A S_Q H_2 C_2 D_Q H_7 C_8 B_Joker C_6 D_8 D_7 D_3 S_7 A_Joker C_10 C_J D_9)
deck=(S_A S_4 C_K S_J H_A H_Q C_5 C_3 S_6 D_J C_9 D_2 H_9 H_3 C_Q S_10 H_5 D_K C_7 H_10 S_K H_K D_10 S_3 H_4 C_4 C_A D_6 H_8 H_6 S_9 H_J S_8 S_2 D_5 D_4 S_5 D_A S_Q H_2 C_2 D_Q H_7 C_8 B_Joker C_6 D_8 D_7 D_3 S_7 A_Joker C_10 C_J D_9)
`
an error occurs even after 35 charakters of plaintext. Here the message is:
./sol.sh: line 425: 1 + : syntax error: operand expected (error token is "+ ")
To investigate further I let echo the deck in
`function generating_keystream () {
#CHECK
echo ${deck[@]}
`
This issue arises with Ubuntu in a wsl subsystem running win11 as well as with a raspberrypi running the latest Raspbian. The respective versions of bash are
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
and
GNU bash, Version 5.0.3(1)-release (aarch64-unknown-linux-gnu)
Attached you will find the sol.sh (modified to use a certain deck and to echo the deck) plus the output of the encryption of 1630 "A"s with the vanilla deck.
error.txt
sol.sh.txt