Hi,
I have decided to publish my python project which provides some convenient functions for manipulating and analyzing the z340 cipher. For now I have decided to upload my project as a private git repository to bitbucket.org. If you are interested to test it or to contribute please send me a PM with your email address and I will invite you. The repository will be public in the future.
In the last couple of days I have refactored the code and commented it a bit. If you are familiar with one or more programming languages it should be no problem to implement you own tests and commit/push them to the repository.
Here is the readme file which is contained in the repository. The formatting is a bit messy, I will fix that later:
And here are some very, very basic samples that show how to use the library. Of course there is much more that you can do with the project. I have implemented dozens of transpositioning ideas and analysis. Just check out the project and explore for yourself.
Example 1:
# Copy the original cipher bigram_test = deepcopy(original_cipher_340) # Change the reading direction bigram_test.change_reading_direction(Snippet.ReadingDirection.BTT_RTL) # Create a period 42 representation bigram_test = bigram_test.create_period_n(42) # Get some stats bigrams = bigram_test.get_repeated_bigram_count() print "Repeated bigrams: " + str(bigrams[1] - bigrams[0]) print "Cyclic score: " + str(bigram_test.calculate_cyclic_score()) Output: Repeated bigrams: 21 Cyclic score: 1608
Example 2:
# Create an 17x20 cipher, filled with "-"
test_cipher = Snippet(17, 20, "-")
# Pick a rectangular part of the cipher
rect = original_cipher_340.pick_rect(0, 0, 5, 7)
# Manipulate it a bit...
rect.rotate(90)
rect.flip_left_to_right()
# Put it in the output cipher
test_cipher.put_rect(rect, 10, 10)
# Another manipulation
row = original_cipher_340.pick_row(0)
row.rotate(90)
test_cipher.put_column(row, 0)
test_cipher.dump()
# Create output for autosolvers
# ("True, True" means: Create flipped and rotated versions, Create plus patterns)
investigator.process_solution(test_cipher, "test_1", True, True)
Output:
H----------------
E----------------
R----------------
a----------------
b----------------
c----------------
d----------------
V----------------
P----------------
e----------------
I---------HNBSybk
f---------Ebrbzw7
L---------R+sbMR+
T---------aBtv+dK
G---------bjMduFQ
g----------------
h----------------
-----------------
-----------------
-----------------
Created files:
test_1.txt
test_1_flip_ltr.txt
test_1_flip_ltr_rotated_90_degrees.txt
test_1_flip_ltr_rotated_270_degrees.txt
test_1_flip_usd.txt
test_1_rotated_90_degrees.txt
test_1_rotated_180_degrees.txt
test_1_rotated_270_degrees.txt
Example 3:
# Create an 17x2 cipher, filled with "-"
test_cipher = Snippet(17, 2, "-")
start_x = 0
for row in range(5):
# Pick some row parts diagonally
part = original_cipher_340.pick_row_part(row, start_x, 3)
# Put them into the new cipher as a stream
test_cipher.put_stream(part.get_as_string())
start_x += 2
# Dump the cipher
test_cipher.dump()
# Create output for autosolvers
# ("True, True" means: Create flipped and rotated versions, Create plus patterns)
investigator.process_solution(test_cipher, "test_2", True, True)
# Create an csv-file which can imported to excel
Snippet.write_to_csv_file(test_cipher, "for_the_excel_fans.csv")
Output:
HER+BjM+UwoVI7F--
-----------------
Created files:
Same like in example 2 + .csv file
Oh….and a happy new year!
In 2017 the cipher will be solved, I am sure!
Happy new year Largo and to everyone else. Nice project.
Nice job, Largo! Thanks for sharing this.