# hc_cry : Hagelin M-209 cryptogram-only attack
-----------------------------------------------

- Author : JF Bouchaudy
- Version: v1.0
- Date   : 2026/06/xx

## Description / Objectives

This program attempts to implement George Lasry's algorithm, 
which allows breaking a message encrypted using the Hagelin 
M-209 cipher machine with only the ciphertext, which is 
only 500 characters long.

This program, written in Go, was not designed for performance 
but rather for educational purposes. Therefore, it does not 
solve problem 12 of my M209 Challenge.

Reference: Ciphertext-only cryptanalysis of short Hagelin 
M-209 ciphertexts, George Lasry et al., 2018, Cryptologia.

## Why use the GO programming language?

The Go language is efficient, perhaps less so than C/C++, but
more efficient than Python, my favorite language. But above 
all, it allows for writing very readable code. Its limited 
syntax further enhances its readability for a wide audience. 
That's why I chose it. A reader will be able to easily 
understand G. Lasry's algorithm and thus rewrite it to 
optimize it in Go, C/C++, or any other language. Even though 
I haven't used Go's parallel programming capabilities, it's 
quite easy to add this approach to my program.


## Installation:

1. Download the archive from my website:
```
$ curl -O http://www.jfbouch.fr/m209/cryptanalysis/hc_cry.tar
```

2. Install the archive (unzip)
```
$ tar xf hc_cry.tar
```

3. Navigate to the project root directory
```
$ cd hc_cry
$ ls # Documentation is located in the "docs" directory
```

4. Compile the application (Go (1.22 or higher) must be installed)
```
$ go build hc_cry.go # Generates the hc_cry executable
```

5. Activate the application. The syntax is displayed with the -h option.
```
$ ./hc_cry -h
```

## Documentations: (into DOCS directory)
- Algorithm:
  Description (in short) of the George Lasry's algorithm.

- Manual: 
  This document explains how to use the program. It describes 
  the options and provides some simple usage examples (without 
  showing the results).

- Structure: 
  This document describes the program's logical structure (its 
  algorithm) and its physical structure (files and functions).
  It provides some guidance for anyone wanting to modify the 
  application.

- Benchmark: 
  This document describes typical usage examples with the 
  generated outputs.
  It is recommended to run these examples before using the 
  program to break cryptograms yourself.

- Summary:
  Summary  of the positive and negative points of my project
  (at end of June 2026)
