<commit_before>## SAGE Encryption Algorithm
---

#### Video

This is a video introduction to the SAGE software: https://www.youtube.com/watch?v=K0SIKCPJQi4

#### Background

This encryption algorithm, implemented in Python, is maintained by <NAME> and <NAME>, two Vanderbilt University undergraduate students. The algorithm and corresponding front-end application were presented at HackNashville in October 2013 and were later submitted as a class project for Math 194 (Linear Algebra) at the end of the fall 2013 semester.

The master branch is a less stable, but more versatile version of the encryption algorithm and is worth taking a look at. Also, please check out the white paper in the Stable branch.

#### Warning

At this point in time, this encryption algorithm is not intended to be used in any serious, real-world applications. There are serious vulnerabilities in the SAGE encryption algorithm (detailed below). These vulnerabilities have been largely ignored because the point of this project is not secure encryption as much as it is a proof of concept using Hill Ciphers and public key encryption.

#### Licensing

This code is open-sourced under the MIT License and can be modified or re-packaged with another application according to the terms of the LICENSE file included in this Github repository.

#### How does it work?

###### Encryption

The SAGE encryption algorithm uses a two-step encryption method. The first step, a padding scheme, is implemented with a simple Hill Cipher. The length of the message determines whether one or two matrices are generated. For example, if there are 41 characters in the message and the chosen matrix size is 5, then one 5x5 matrix and one 6x6 matrix will be generated. The first matrix will be used seven times to encrypt a total of 35 characters of the message. The second matrix (6x6) will be used to encrypt the remaining 6 characters of the message.

Once the message has been encrypted by the Hill Cipher, the public key pair of the person you want to send the message to is used to encrypt both the matrix and the padded message (please note that packaging the key to the padding scheme __with__ the message itself is a __serious__ vulnerability in the SAGE encryption method). The public-key encrypted message can now be sent to its intended recipient.

###### Decryption

When the encrypted message is received by its intended party, the first layer of encryption can be undone by using the correct private key. Once this layer of encryption has been unlocked, both matrices are inverted and used to undo the padding scheme of the message. The message is now human-readable.

### Usage
<commit_msg>Made "don't roll your own crypto" warning more clear<commit_after>## SAGE Encryption Algorithm
---

DO NOT USE THIS SOFTWARE AS A CRYPTOGRAPHY SOLUTION. IT IS FOR LEARNING PURPOSES ONLY.

#### Video

This is a video introduction to the SAGE software: https://www.youtube.com/watch?v=K0SIKCPJQi4

#### Background

This encryption algorithm, implemented in Python, is maintained by <NAME> and <NAME>, two Vanderbilt University undergraduate students. The algorithm and corresponding front-end application were presented at HackNashville in October 2013 and were later submitted as a class project for Math 194 (Linear Algebra) at the end of the fall 2013 semester.

The master branch is a less stable, but more versatile version of the encryption algorithm and is worth taking a look at. Also, please check out the white paper in the Stable branch.

#### Warning

This encryption algorithm is not intended for use in any serious, real-world applications. There are serious vulnerabilities in the SAGE encryption algorithm (detailed below). These vulnerabilities have been ignored because the point of this project is not secure encryption, but rather to learn about encryption that uses Hill Ciphers and public key encryption. We are fully aware of the "Don't roll your own crypto" proverb.

#### Licensing

This code is open-sourced under the MIT License and can be modified or re-packaged with another application according to the terms of the LICENSE file included in this Github repository.

#### How does it work?

###### Encryption

The SAGE encryption algorithm uses a two-step encryption method. The first step, a padding scheme, is implemented with a simple Hill Cipher. The length of the message determines whether one or two matrices are generated. For example, if there are 41 characters in the message and the chosen matrix size is 5, then one 5x5 matrix and one 6x6 matrix will be generated. The first matrix will be used seven times to encrypt a total of 35 characters of the message. The second matrix (6x6) will be used to encrypt the remaining 6 characters of the message.

Once the message has been encrypted by the Hill Cipher, the public key pair of the person you want to send the message to is used to encrypt both the matrix and the padded message (please note that packaging the key to the padding scheme __with__ the message itself is a __serious__ vulnerability in the SAGE encryption method). The public-key encrypted message can now be sent to its intended recipient.

###### Decryption

When the encrypted message is received by its intended party, the first layer of encryption can be undone by using the correct private key. Once this layer of encryption has been unlocked, both matrices are inverted and used to undo the padding scheme of the message. The message is now human-readable.

### Usage

{'fraction_non_alphanumeric': 0.03985441310282074, 'fraction_numerical': 0.009099181073703366, 'mean_word_length': 4.5683890577507595, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6357054', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1210, 'n_words': 864}