31
votes
Encryption algorithm for an app
No. This is just a worse Caeser cypher.
steps to break:
Convert each string to an int in the output
Subtract everything from the min output value - ord('A')
...
30
votes
Accepted
A Caesar cipher in Python3
You say you're new to Python. Well, that's ok. And a Caeser Cipher is a good place to start since it's complex enough for an absolute beginner while easy enough to understand what goes on, why and ...
Mast♦
- 13.8k
27
votes
AES Implementation in C++
Since there are only three valid key sizes for AES, it makes sense to not even let the AES class be instantiated with any uint16 value. I would introduce an enum ...
24
votes
Accepted
Fast symmetric key cryptography class
Here are a number of things you could do to improve the code.
Separate interface from implementation
The interface goes into a header file and the implementation (that is, everything that actually ...
23
votes
Accepted
AES Implementation in C++
I'm looking to improve the code to make it not "DIY-crypto-bad", if at
all possible
I work in security. This is not my area, but I have a non-zero amount of knowledge on implementing secure ...
18
votes
Naïve RSA decryption in Python
Simple does not mean fast, so you cannot judge performance based on how simple the implementation looks. Usually the most efficient way to perform a non-trivial task is not also the simplest way to do ...
18
votes
Accepted
Employing 3DES algorithm in Java
It's kind of secure, but it uses older algorithms.
Although Benjamin correctly identifies 3DES, I would not call 3 key triple DES "broken". It still delivers a security of about 112 bits which nobody ...
18
votes
A Caesar cipher in Python3
I hate to provide an "answer only" code review, but I'd like to expand upon Mast's "Python comes batteries included" point:
Python comes with a str.translate, ...
18
votes
A randomized encryption program
First, congratulations! Being able to produce something usable with another person is an incredibly important skill, and especially in programming. Please don't worry about the amount of suggestions ...
16
votes
Accepted
SHA-256 Implementation
The functions that are not used outside of a translation unit should be defined as having internal linkage:
Everything except sha256() should be defined with the <...
16
votes
Accepted
Python secrets command-line tool
UX for the CLI
some commands you can run with this tool: sct -tokenhex 8, ...
That's nice.
But wouldn't you like to also expose ...
15
votes
15
votes
Accepted
Cryptographically Secure Password Generation in C
Overall, this is pretty well written. It's very easy to read and understand. I especially like that you annotated the usage() function with ...
15
votes
SHA-256 Implementation
On top of what Harith has already posted:
Your program isn't scalable
Hashing files is intended to work on files of any size. Your program implicitly assumes it will only be used with files that fit ...
14
votes
Accepted
RSA algorithm implementation in Python 3
I think your Modular Inverse implementation is slow. We can apply this Extended GCD algorithm recursive implementation which shows quite a dramatic speed improvement (at least on my machine):
...
14
votes
Accepted
Implementation of the Jacobi Symbol in C
I am only looking for some feedback on my coding style.
Formatting is good. I hope it is auto formatted.
Respect the presentation width
Rather than oblige a horizontal scroll bar, auto format to a ...
14
votes
Fast symmetric key cryptography class
Please do not roll your own encryption outside of an academic context.
If you would like a fast algorithm that can be easily implemented in C/C++ take a look at ChaCha or Salsa. Runs great on most ...
14
votes
Secrets management, operational security, keeping API tokens hidden while streaming
Your main is a classic arrow anti-pattern. You can use guard clauses to make the code flat and easier to understand.
Bare excepts are normally not a good idea. Why ...
13
votes
AES Implementation in C++
I think the header could be trimmed down a lot. The constant tables belong in the implementation file since they are not needed for the definition of the class.
Since the AES class does not hold any ...
13
votes
Accepted
Self-contained SHA-256 implementation in C
Nice implementation. Good attention to shift types.
Use bool. Various members, functions are used only in a boolean fashion. Use ...
13
votes
Encryption algorithm for an app
In addition to Oscar Smith's answer why this code is not secure, here are a few nitpicks on your code itself:
While it is legal to end a line with ; in Python, it ...
13
votes
Accepted
Data encryption with python
That seems like a very long method to splice and put together the string every even set of characters. You are essentially trying to build a square matrix using the characters from the given string. ...
13
votes
Employing 3DES algorithm in Java
No, it's not secure.
Your code is using Random instead of SecureRandom, which limits the entropy of the salt to 48 bits.
In ...
12
votes
Data encryption with python
One of your lines of code is horribly cryptic. I think it's so bad it's worthy of it's own answer.
...
12
votes
Fast symmetric key cryptography class
Regarding the cryptographic algorithm only:
Important observations
This is equivalent to an XOR cipher with a repeating 256-byte key. The key16 stuff adds no security. The randKey stuff adds no ...
12
votes
A randomized encryption program
In addition to the great answer already provided by l0b0, a few comments.
1. code structure
Some blocks could be extracted to functions. For instance, the following block inside ...
11
votes
Accepted
ECDH implementation in python
You can easily replace your Point class with namedtuple here. In fact the docs itself contain an example related to a ...
11
votes
AES Implementation in C++
You don't show us the BlockCipher base class, but it appears that it imposes a terrible interface on us:
...
10
votes
MD5 implementation in C++11
First impressions
The code seems very clean and tidy. As far as I can tell, you're including exactly the required headers - no more, and no less. There's generally good use of ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
cryptography × 522python × 116
security × 116
c# × 92
aes × 82
java × 80
c++ × 45
performance × 45
beginner × 40
c × 40
php × 38
python-3.x × 37
algorithm × 29
reinventing-the-wheel × 27
javascript × 25
.net × 23
hashcode × 19
random × 16
strings × 14
openssl × 14
rust × 11
python-2.x × 10
file × 10
vb.net × 10
programming-challenge × 9