Skip to content

Hill Cipher implementation #2431

@ojasva

Description

@ojasva

Is your feature request related to a problem? Please describe.
Hill cipher is a polyalphabetic substitution cipher. Each letter is represented by a number belonging to the set Z26 where A=0 , B=1, ..... Z=25.
To encrypt a message, each block of n letters (since matrix size is n x n) is multiplied by an invertible n × n matrix, against modulus 26. To decrypt the message, each block is multiplied by the inverse of the matrix used for encryption.
The cipher key and plaintext/ciphertext are user inputs.

Describe the solution you'd like
The solution implementation will mainly follow as:
We form a n x n matrix from the key received and declare a n x1 matrix. Check if determinant of key = 0 (mod 26) , if not proceed. Then we read n letters of plaintext in the n x1 matrix, encrypt them by multiplying with the key matrix, and continue until the whole plaintext is encrypted.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions