ighalogenesisosasenaga / cryptography Goto Github PK
View Code? Open in Web Editor NEWThis is a repository exploring different encryption methods.
License: MIT License
This is a repository exploring different encryption methods.
License: MIT License
The decrypt function has a problem I can't think of a way to solve.
def _decrypt(self):
output = ""
# Variable to store suspected sequences
current_sequence = ""
# Replacement dictionary for special characters
replacement_dict = self._nulls
# Boolean to know if the current_sequence variable is not empty
in_sequence = False
for char in self._lampboard:
if not in_sequence and char in self._sequence_marker:
# Start a sequence
current_sequence += char
in_sequence = True
elif in_sequence:
# Add a character to the current sequence if it's length is less than 3
current_sequence += char
if len(current_sequence) == 3:
# Current sequence has reached max length, so add the corresponding special character to the output if current_sequence is found in the dictionary else add all the letters in current sequence to the output
output += replacement_dict.get(current_sequence, current_sequence)
# Important reset
current_sequence = ""
in_sequence = False
else:
# Add character to output as character doesn't begin a null sequence and current_sequence is empty
output += char
return output
This function actually gets called after decryption though. It's purpose is to replace special sequences in decrypted text with a special character mapped to the sequence.
E.g
input: HELLOHRLWORLD
return value: HELLO WORLD
Problem
input: JUSTHRLME
return value: JUSTHRLME
input: THISHRLFOOD
return value: THI)LFOOD
At first I thought the sequence of nulls for special characters would be good. But that didn't seem to work out in my head. So I'd really appreciate help on this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.