Questions tagged [cryptography]
Questions relating to cryptographic topics such as encryption/decryption and hashing. (Not for use with trivial ciphers.)
474
questions
0
votes
0
answers
8
views
What's wrong with the following implementation of MD5? [migrated]
I'm trying to implement a MD5 hash function in C. I've read the RFC, and done the following, and am trying to figure out what's wrong in here. I know that I should probably be using a library like ...
2
votes
2
answers
176
views
Encrypt a String using AES in CBC mode
Your opinion interests me regarding this program.
This program encrypts a text message using the AES256 algorithm and CBC.
It allows the creation of an encrypted message that contains:
The salt used ...
3
votes
2
answers
167
views
Encrypting large files using RSA and AES-256-CBC-HMAC-SHA384
I developed an application that stores large files. Those files are stored in plain text. Now the project owner wants those files be encrypted on storage, he wants confidentiality, integrity, and ...
11
votes
3
answers
2k
views
SHA-256 Implementation
I've been working on a byte-oriented SHA-256 implementation for educational purposes. I then tested it using the NIST CAVP tests found here.
All tests pass but I would appreciate some feedback from a ...
3
votes
1
answer
94
views
Encrypted websocket chat using AES (EAX) and RSA for signing
For learning purposes and because it really interests me I am trying to get a better understanding of cryptography by trying to make my own basic secure chat-application. I posted a first version of ...
3
votes
1
answer
140
views
Encryption implementation for websocket chat (RSA + AES)
For learning purposes I am trying to make a encrypted chat in Python using Websockets. I am using AES and RSA to make it safe.
The idea of the chat is that it's a group-chat. Users can join a chat by ...
2
votes
1
answer
72
views
An implementation of encryption cascade
I'm looking for feedback on some source code, I have everything documented and have corrected some errors. Looking to see what I did correctly, incorrectly, and what can be improved.
...
3
votes
1
answer
67
views
Implementation of aes-cbc-hmac combined with xchacha20-poly1305
I’m using two ciphers in this code that are in this order- encrypt plain text with xchacha20-poly1305 then encrypt the resulting ciphertext with aes-cbc-blake2b hmac.
I was told elsewhere rather than ...
1
vote
1
answer
84
views
Password database: saving and loading encrypted files
I'm writing a password manager application, mostly with the goal of learning about proper handling of encryption.
Here is my code responsible for encrypting/decrypting passwords and loading to/from ...
2
votes
2
answers
142
views
AES-GCM and AES-CBC-HMAC encryption methods
Looking for code reviews of these two encryption methods. And if GCM is better or worse than CBC with HMAC.
AES-GCM
...
6
votes
3
answers
143
views
Idiomatic and performant file hashing
I've written a small program that will accept a directory path and recursively calculate the MD5 hash of each file.
...
2
votes
1
answer
115
views
Password recognition with cryptography
Since I only just learnt about this, I wanted some advice on better practices I can use when it comes to cryptography. Still learning python and hoping I can get this 'hashing' and 'salting' thing in ...
-3
votes
1
answer
177
views
Simplistic C program to encrypt and decrypt a string [closed]
I wanted to improve a crypter from internet. I found it poor and modified it.
Do you like it?
...
2
votes
1
answer
113
views
Generate a valid private key from public key
Given a public key, I want to generate a corresponding private key. I know this will take at least decades or centuries on average to achieve.
I am wanting to increase performance as my current code ...
2
votes
0
answers
153
views
0
votes
1
answer
2k
views
Encrypt and decrypt text using 256-bit AES-GCM
I'm working on building an encrypt/decrypt feature using AES, and a fixed AES 256-bit key size. I have decided on using AES-GCM, as it seems the most performant and secure.
I would like to know ...
5
votes
2
answers
1k
views
SHA-256 Hash with a short string length in javascript
I think I've found a way to somewhat "compress" the length of a SHA-256 hash. I am doing some addition, so I wanted to know whether an approach like this is secure or not.
...
5
votes
1
answer
174
views
Hybrid encryption library for text/image encryption (additional feature implementation)
I am coding a hybrid encryption library that utilises AES and RSA to encrypt text/images, The library is working fine however I am wondering if I can make any improvements to it. I have included ...
2
votes
1
answer
172
views
An evolutionary algorithm written in Java to crack an XOR cipher
Alright. So TryHackme is a website that tries to teach hacking with hands on labs. They have a room called JVM Reverse Engineering where the user gets to reverse engineer Java apps, and in particular ...
8
votes
1
answer
474
views
Improving the speed of an MD5 implementation from scratch in C++
I wrote an implementation of the MD5 hashing algorithm from scratch in C++, following the original RFC: https://www.ietf.org/rfc/rfc1321.txt . It works as expected, and the outputs match all the test ...
4
votes
0
answers
121
views
Securely generate Token for authentication
In my experience i had the need that some application (both desktop and web) can excange data to authenticate users (even if the data for authenticating users are not reacheable form desktop ...
1
vote
1
answer
56
views
3
votes
1
answer
190
views
My Encryption Decryption Algorithm
I have been trying for so long to code an encryption/decryption algorithm using the modulus operator. Basically my code does a basic mathematical operation on given text and key then do a modulus 255 ...
1
vote
0
answers
8k
views
Simple AES encrypt/decrypt methods for .NET 6 and .NET Framework
I wrote some AES encryption/decryption methods with the following requirements:
Inputs should be easy-to-use strings.
Something encrypted in a .NET 6
app using these methods should be able to be ...
0
votes
2
answers
2k
views
AES GCM C++ implementation
I have written a C++ program that uses the Crypto++ library to encrypt files using AES-256Bit (in GCM mode). I am planning to eventually have the program store the keys for the files in a file e.g. ...
3
votes
2
answers
700
views
Encryption algorithm for chat app
I'm working on a CLI chat app using Python and I've coded this encryption algorithm.
I used hybrid encryption.
This uses an AES key as the shared key for encryption and decryption and RSA to encrypt ...
3
votes
0
answers
322
views
Simple Merkle Tree
Discussion
I just started learning about Merkle Trees and wanted to get some practice by attempting to implement a very simple Merkle Tree.
The constructor for the tree takes some type of hash ...
0
votes
2
answers
875
views
Encryption and Decryption in C
I have written a program in C, which encrypts and decrypts a c-styled string (const char *) and print the result to stdout. It ...
5
votes
1
answer
1k
views
Rijndael Cipher in C++ (128bit AES)
I am a hobbyist and do not work in the industry, but I do have an interest in programming an cryptography. I decided to have a go at writing a 128bit implementation of AES in C++. This is my first ...
3
votes
0
answers
97
views
Arduino portenta H7 compatible message encryption and decryption
I am looking to build a message encryption/decription method that would allow messages to be encrypted in a timely fashion on board an Arduino Portenta H7, using as much of the onboard hardware ...
2
votes
0
answers
68
views
Simple CLI File Encryption
This program is designed to work on the command line by piping stdin to stdout and encrypting or decrypting the input using a symmetric key.
Any suggestions for improvement would be greatly ...
4
votes
0
answers
125
views
RC4 stream cipher in ARM Assembly
Below is a complete implementation of RC4 in ARM assembly. Unit tests pass, including comparison to C implementation and to published test vectors.
I'm appreciative of all feedback, comments (things ...
1
vote
1
answer
509
views
1
vote
1
answer
2k
views
.Net BouncyCastle - PKCS#3, PKCS#8 & PKCS#10 Generation as base64
Reaserching BouncyCastle for C# is not for the faint of heart. After navigating an ocean of Java dead ends, I have arrived at the following code.
I believe it's very useful for someone who wants to ...
4
votes
5
answers
6k
views
C++ AES Encryption Class
I am working with OpenSSL and writing an AES256 encryption module. My knowledge of cybersecurity is not vast and I would like to know whether there are any obvious holes I'm leaving. The intent is for ...
2
votes
1
answer
3k
views
Python 3 Playfair cipher encrypter and decrypter
I have written a Python 3 program that can encrypt and decrypt Playfair cipher, though I know it has been implemented countless times, none of the scripts I have seen so far(e.g. https://codegolf....
4
votes
1
answer
167
views
Enigma Implementation by Python newbie
I want to learn Python, so I ported a C# Enigma implementation of mine. It got UnitTests and is running.
I'm looking for a review, telling me, where I don't know best practices, where I break naming ...
4
votes
2
answers
193
views
Enigma Implementation by JAVA newbie
I want to learn Java, so I ported a C# Enigma implementation of mine. It got UnitTests and is running.
I'm looking for a review, telling me, where I don't know best practices, where I break naming ...
4
votes
1
answer
278
views
Cryptographic hashing class using OpenSSL's EVP interface
I have written a cryptographic hashing class named Ccksum::DigestHasher that allows the caller to select a hashing algorithm by name via OpenSSL's EVP interface. ...
0
votes
1
answer
273
views
Encryption/Decryption algorithm #3
This is a follow up question to Encryption/Decryption algorithm #2 and Encryption/Decryption algorithm.
In my last question, in @Reinderien's answer, he added this line ...
2
votes
1
answer
145
views
Encryption/Decryption algorithm #2
This is a follow-up question to this one.
I have tried to implement all the recommended things in the answers (except commenting, and not being OS specific). Again, if you see anything that needs ...
3
votes
3
answers
156
views
Creating a class and calling it from other .py files
My objective with this code was to create a class and call it from other .py files. The code itself is working, but I would like to know what could be improved or be better implemented.
I wrote ...
5
votes
1
answer
3k
views
Login system using bcrypt and MySQL, to be used for any future projects
Main function will ask what the user wants to do. LoginSystem class will handle the sign up and login process as well with the checking if password is right. passwordHashing will use bcrpyt to salt ...
1
vote
1
answer
3k
views
Encrypted text - C# SHA256, implementation
I have a C# application which needs to encrypt string and save the key as a hash. The key is saved as a hash to check the right key has been input before trying to decrypt the message.
First, I have ...
5
votes
3
answers
1k
views
Caesar Cipher Encryption / Decryption in Python
I'm trying to write a Python program to predict the most likely substitution for a Caesar cipher. I managed to get it working, but it just seems very clunky and slow, especially because I need to ...
2
votes
2
answers
188
views
Encrypting/decrypting messages in java
I am trying to implement message encryption/decryption with password in java. Here is the code I'm using:
...
3
votes
2
answers
137
views
Correct implementation of encryption function
I wrote a simple encryption function that uses argon2d as the KDF and XChaCha20-Poly1305 as the AEAD. Since it is very easy to not get things right when dealing with encryption, I would appreciate if ...
6
votes
2
answers
3k
views
AES implementation in python
For educational purposes, I have implemented the AES block cipher in python. I decided to follow the interface for block cipher modules as defined in PEP 272. The implementation consists of two python ...
3
votes
2
answers
1k
views
Encryption/Decryption between Python and Node JS
I have created a Python & Node JS encryption/decryption AES 256-CFB. The point of this little project is that I will encrypt a special URL with Python covered with base64 & URL encoding and ...
3
votes
0
answers
85
views
Implement kleptography in Python
I'm new here, therefore I hope to be clear in this question. Firstly, I want to underline that I'm not a programmer, and I attended only a beginner course in Python, but I like to solve problems ...