Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should identify that the key can only use AVAILABLE_CHARS characters #5

Open
ziserendexin opened this issue Dec 18, 2018 · 0 comments

Comments

@ziserendexin
Copy link

ziserendexin commented Dec 18, 2018

I want use it to encrypt some low confidentiality string,and use the key like zise_some_thing_happen.
But the encryt_string is a bit long

It decrypt some charact worry(part of my data).
like:
"time": "2018-12-14 17:59:16",
to
"tyme": "2018-12-14 17:59:16",

And it will not show in short string.
the reason maybe is in this if.

if(isalnum(msg[i]) or msg[i] == ' ') {
    encryptedMsg[i] = AVAILABLE_CHARS[((index(msg[i]) + index(newKey[i])) % AVAILABLE_CHARS.size())];
} else {
    encryptedMsg[i] = msg[i];
}

After base64, some string will change to '_', and it will get worry index in newKey.

But I can't recurrent it in short string, and my error string have a little confidentiality needs. if you need it. Please give me a email, and i will send it to you.

On the other hand,
in

encryptedMsg[i] = AVAILABLE_CHARS[((index(msg[i]) + index(newKey[i])) % AVAILABLE_CHARS.size())];

AVAILABLE_CHARS.size() is a determine value, and .size() will caculate this value every time in your for loop.

It will better in this way:

AVAILABLE_CHARS_SIZE = AVAILABLE_CHARS.size()
for(i = 0; i < msgLen; ++i) {
    encryptedMsg[i] = AVAILABLE_CHARS[((index(msg[i]) + index(newKey[i])) % AVAILABLE_CHARS_SIZE)];
}

At last, in windows, call exe in cmd have max limit,32768. so if your encrypted string is too long, you can`t decrypt or encrypt it in python.

0rangeFox added a commit to 0rangeFox/easy-encryption that referenced this issue Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant