The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [cryptography]

Questions relating to cryptographic topics such as encryption/decryption and hashing. (Not for use with trivial ciphers.)

Filter by
Sorted by
Tagged with
15
votes
3answers
17k views

RSA algorithm implementation in Python 3

First, a reminder of the RSA algorithm and what my program implements: Take two distinct, large primes p and q Ideally these ...
15
votes
2answers
1k views

ECDH implementation in python

I wrote an implementation of elliptic curve Diffie-Hellman key exchange in python. I would like to know if I could make it faster, cleaner or more secure: ...
1
vote
1answer
144 views

Command based Address book app with encryption and store facilities

I'm new to programming. I wrote the following code in python. It's a cmd based address book. ...
4
votes
2answers
135 views

File's encryption tool in terminal

I've created a wrapper for the SimpleCrypt library that allows to easily encrypt/decrypt a string. The application is used this : ...
2
votes
1answer
224 views

Bash - script to encrypt pdf files using pdfencrypt

I wrote a small script to get around the issue when using pdfencrypt on the command line the password is always echoed as well as being saved to the 'history'. <...
2
votes
2answers
806 views

Linear Feedback Shift Register

I haven't found any implementation in C# of the LFSR so accordling to Wikipedia i have implment it to myself. https://en.wikipedia.org/wiki/Linear-feedback_shift_register My implementation accept ...
3
votes
1answer
160 views

My images have secrets A.K.A. the making of aesthetic passwords V.2

This is my implementation of a prng steganography tool written in Python. You can also find the code on GitHub. Steganography is the art of hiding messages in (images, videos or even audio) I've ...
3
votes
1answer
741 views

ChaCha20 Implementation (based on RFC7539)

Rolling my own cryptography in order to better understand the subject and came up with implementation of the ChaCha20 algorithm pasted below. I'm using the test vectors listed in the RFC along with ...
11
votes
4answers
2k views

Homemade cyraz encryption algorithm

The "Cyraz" encryption algorithm was presented on SOPT community. This algorithm makes a cypher using a private key given in byte[] format with any arbitrary ...
11
votes
2answers
2k views

Baconian Cipher Python Implementation

I have been trying to implement various substitution ciphers in python. I implemented the Baconian cipher using a dictionary in which the plaintext letters are keys and the ciphertext letters are the ...
2
votes
0answers
564 views

Hashing a SecureString in C#

In .NET, the SecureString type exists to prevent leaking secrets in memory. I want to create a hash from the contents of a SecureString, without putting the contents in memory in a place where I can't ...
1
vote
0answers
53 views

Unicode-friendly password generation

The following algorithm is meant to generate a password from a given set of characters, and a length. Is it biased or predictable in any way? And are graphemes the appropriate Unicode thing to use ...
3
votes
1answer
296 views

Cryptopals Challenge 1.6 Solution in Golang

This is my solution to challenge 1.6 from Matasano/NCC Cryptopals. Here is my repository so the code can be cloned/ran and the bitutils/futils code can also be looked at if necessary (I've created ...
4
votes
2answers
190 views

Basic Crypto for .NET

Please tell me if I'm doing this right, and what else is needed to make this hardened. It seems like it's too simple, like there's almost nothing I'm actually doing. For example, there are 4 or 5 ...
6
votes
2answers
3k views

Encrypting files in a directory (AES)

I am quite new to Python (and programming in general). I was trying to create a command-line program for encrypting my files. Please tell me what I can improve (styling, crypto, etc.) Disclaimer: I ...
1
vote
1answer
1k views

Hash password and verify password with Node's Crypto

I would like to make a safe way to store hashes of user passwords and verify them later. Here is crypt.js: ...
14
votes
1answer
8k views

MD5 implementation in C++11

I'm writing a C++ implementation of the MD5 hashing algorithm based on the pseudocode of this wikipedia article. ...
5
votes
1answer
1k views

Custom password encryption

The point of the program will be to have an file that will hold encrypted passwords which will only be unlocked by the password that encrypted them. I don't plan to use it in any web application/login ...
1
vote
1answer
681 views

Unit test for the right kind of cryptography key

I have a quite large unit test case for one class that currently does not exist, I am going to write it after finishing the test case. I am wondering if my unit test doesn't lack something important, ...
2
votes
1answer
399 views

Encryption in C#

I have got to my self these two functions (Encryption and Decryption): ...
1
vote
1answer
4k views

Play Fair Cipher Implementation

I have implemented a play fair cipher. The code works fine but I would like to improve the clarity and/or performance of the code. First a quick description of how it works. You are given a string to ...
8
votes
3answers
4k views

Generate cryptographically secure random numbers in a specific range

A project I'm working on requires generating a random number of \$N\$ length to a very high degree of fair distribution between digits \$[0, 9]\$. That said, I used the ...
1
vote
1answer
939 views

encrypt/decrypt person data

Ahead of the General Data Protection Regulation (GDPR) I begin to crypt more than ever before, in fact, all I can crypt become crypt. However, I wonder if anybody can tell me if this code is secure ...
1
vote
1answer
279 views

Custom password hashing

I have been creating a class for users on my account. OOP and classes are not my strong point. Below is an extract from my class which I use to create a hash (that will be stored in a database) and ...
1
vote
1answer
128 views

AES Java security

I am new to security and I was wondering if I can make my program better by changing or adding something to make it better/secure. Should I use a keyGenerator? I have my doubts from my program output....
4
votes
2answers
1k views

Simple hashing and salting algorithm

I have devised what I feel to be a simple hash/salting algo for Java, and am looking for some feedback from people more skilled than myself. Please find below my code; ...
2
votes
0answers
669 views

Wrapper/abstraction for encryption and decryption using OpenSSL

I am a beginner when it comes to cryptography and OpenSSL. I have written a short wrapper of some functions in OpenSSL as well as a test of this wrapper, copied below. Specifically, this code is ...
4
votes
1answer
1k views

Rijndael compression/encryption class

Out of personal interest and as a learning exercise I've written a C# class (.NET 4) to perform encryption/decryption of a file along with some compression upon encryption. Most of my understanding of ...
7
votes
1answer
182 views

Linux/Mac hashing SHA-1

To do password exchange on the SQL server I need to use SHA-1 to generate a hash (no plain password exchange). This is done differently on Linux/Mac so I abstracted it slightly. ThorCryptWrapper.h <...
7
votes
2answers
712 views

One Time Pad in Python

I'm new to Python, but I really want to get into the swing of doing things the pythonic way. First, does my code follow the pythonic path? Or does it run screaming bloody murder, as it zig-zags ...
5
votes
1answer
3k views

A Simple Caesar Cipher in Python

I wrote an encryption/decryption algorithm for the Caesar Cipher. It works fine, but I'm curious if there are any constructive critiques, tips, tricks, comments, or advice anyone may have on how the ...
5
votes
4answers
3k views

Random Password Generator in C#

Security is a huge complicated subject. What I'm looking for here is three things: The password generating algorithm isn't reversible, meaning that when someone looks at the source code of this ...
3
votes
1answer
879 views

RC4 implementation

I am using the following implementation of the RC4 encryption algorithm in C# ...
4
votes
2answers
545 views

Generate a Bitcoin Address and the Wif from a phrase

Is there a way to speed up my Python code? ...
6
votes
1answer
705 views

Golang crypto library: security

I've recently put together a library for working with Crypto in Go. I did not roll my own, I'm relying on stdlib for the core parts of this, but I would still like to get this reviewed by some ...
1
vote
1answer
112 views

doCrypto method for asymetric key (RSA)

I'm implementing rsa and aes classes in java, but i have some trouble with the rsa implementation. Since i have two keys in asymetric encryption, with two different types, i've made two differents ...
6
votes
1answer
2k views

AES encryption/decryption using pure .NET and streams

I'm trying my hand at simple encryption and decryption. Ideally I'd like to be doing it the 'right' way, ie something secure without doing it in a way that will have a serious hole. I'd prefer to do ...
6
votes
1answer
224 views

“Cryptographic” hash function

I don't know much about the design of cryptographic hash functions but despite that I made an attempt for the sake of learning. This is what I got: ...
2
votes
1answer
112 views

Need help to make a more secure AES class

I've been working on my first "big" project in java, an AES encryption and decryption class, it's now working but i don't know how to improve my code. Also i'm not the best in security and I have no ...
9
votes
1answer
1k views

Secure client-side encryption of user content

I am working on a pet project of mine which I've recently revived after a year long hiatus. The application is a note-taking application with client-side encryption. If you need an analogy think ...
2
votes
1answer
1k views

Making AES encryption in Go just a little easier

AES encryption in Go is already pretty simple, Gencrypt is a package that acts as a wrapper around Go's standard packages used for AES encryption to make it even more simple. https://gitlab.com/...
1
vote
4answers
2k views

Java class to compute and get a MD5 hash as a string

Here is my class file to compute MD5 hashes on a file. I wanted to be able to easily calculate them without having to create a lot of overhead in the code using the class. Can anyone tell me a list ...
4
votes
1answer
384 views

One time key for authentication

In a recent project I was to create a web service that would be consumed by another application. One of the requirements was to have a key in the service that authenticated the request as valid. But ...
2
votes
1answer
101 views

Vector-based Null Cipher

Continuing with my series of cipher programs, I hastily wrote a null cipher program, and I was wondering how it could be improved: ...
2
votes
1answer
626 views

Split string into “n” lengths with padding

I quickly wrote a short program to split a string into \$n\$ lengths with variable-character padding: ...
2
votes
0answers
41 views

Symmetric decryption with javax.crypto

I'm trying to determine if this code could be a memory hog with huge files. Can anyone tell me if there is anything I can do to make this more memory efficient, or is this how java.crypto works? <...
2
votes
0answers
174 views

Locally encrypt/decrypt credentials

I wrote some code to encrypt and decrypt some user credentials for services that a locally run application needs to work. I get a password from the user, use it to stretch a key via Scrypt, and then ...
8
votes
1answer
328 views

Securing a file encryption(ECIES) protocol using Scrypt + Inferno

I'm evaluating the security level of a file encryption app, which implements Scrypt and Inferno, in an ECIES context. The encrypted files are either stored on the user's PC/laptop, either sent with ...
3
votes
0answers
1k views

Encode object to JSON and encrypt with AES (with tests)

While the task at hand is relatively straightforward, it turned out AES in Go is a bit clunky so I was wondering if this seems right. Also, any tips on Go coding in general are more than welcome. <...
2
votes
1answer
2k views

Decrypting single byte XOR encryption

The code along with the utils module is also at github. If you'd also have any advice on how the whole crate is structured I'd love to hear it. :) ...