This tag is used for code review questions relating to cryptographic topics such as encryption/decryption and hashing.

learn more… | top users | synonyms (1)

10
votes
5answers
2k views

Enigma Machine Simulation

This is an Enigma Machine Simulator written in Java: Enigma.java ...
1
vote
2answers
35 views

AES-encrypted key store

I am writing a program that needs to retain specific data but that should not be easily readable. I am in no way very skilled in crypto but I wrote this class that takes all of the data in and then ...
10
votes
1answer
84 views

Decrypting a substitution cipher using n-gram frequency analysis

This is a solution for the June 2015 Community Challenge: a program that decrypts a monoalphabetic substitution cipher. It's written in Python 3, but should be portable to Python 2 if you use ...
2
votes
0answers
24 views

Big Integers and parallel execution with OpenMP

This is part of an implementation of Rabin-Williams signatures as described by Bernstein in Section 6 of "RSA signatures and Rabin–Williams signatures: the state of the art" using Tweaked Roots. The ...
4
votes
1answer
38 views

Hashing a SecureString using Cryptography Next Generation

Goal: I needed to calculate the salted hash of a password, where the password is stored as a SecureString. There doesn't seem to be much .NET framework support for SecureString. In particular, none ...
3
votes
1answer
70 views

Very simple asymmetric RSA encryption in C#

Based on this: asymmetric encryption in C# I added some more functionality to make it even easier to use (I combined the keySize and the ...
2
votes
0answers
43 views

Vulnerability of Encryption class usiing AES + HMAC

I've written an encryption-decryption class that is to be used in my companies commercial web application that will handle sensitive information. The encrypted data will be passed over the internet ...
3
votes
1answer
55 views

Recreating binary counter for arbitrary length arrays

After weeks of slaving over FIPS-197, I finally have my own working C/C# implementation of AES-128 which I'm quite happy about. The next thing I'm looking to do is implement a ...
3
votes
1answer
89 views

Python mnemonic <==> hex conversion (Bitcoin BIP39)

Following up from the fantastic feedback re pbkdf2 code... I'm looking for commentary on the following code, which converts from a hex seed to mnemonic (12 word phrase), and vice versa. It's for ...
4
votes
1answer
99 views

Python PBKDF2 using core modules

I'm trying to implement pbkdf2 in Python 2.7/3.4 without needing the pbkdf2 module. (I'm also trying to avoid using classes.) Any insight would be appreciated: ...
1
vote
0answers
79 views

Web API 2 - JWT with X509 certificate

I got my JWT generation working with X509 and wanted to ask if you would recommend any changes in respect to: Signing certificate storing / handling. Publishing for anonymous access public key ...
3
votes
0answers
62 views

MD5 hash comparison for two folders

Using this page for a starting point into comparing MD5 hash values from files in two different folders, I've put something together that outputs either Copied if ...
1
vote
0answers
84 views

Java program to encrypt files using Shamir Secret Sharing

Shamir's Secret Sharing scheme essentially splits a secret into n parts, at least k of which are needed to recover it. I'm using that to encrypt/decrypt arbitrary files (it's part of a college ...
5
votes
2answers
550 views

Encrypting a string using AES/CBC/PKCS5PADDING

The code below takes a String and encrypts it using AES/CBC/PKCS5PADDING as transformation. I am learning as I go and I have a few questions about my code. Is ...
3
votes
2answers
499 views

Encrypting and decrypting passwords in PHP

I am wanting to encrypt a password and decrypt a password using PHP. Is this a safe method? ...
8
votes
1answer
264 views

C# AES + RSA Encryption Implementation

I've put together an AES encryption implementation to solve a set of requirements. I believe that I've met the requirements, but I'd like to see if anyone is willing to review the implementation to ...
3
votes
1answer
142 views

.Net BouncyCastle - CSR and Private Key Generation

The purpose of this code is to generate the CSR and the Private Key. The scenario is that we have some clients for whom we run websites and for the SSL component we want to have a page on our site ...
3
votes
2answers
100 views

Encrypt string using One Time Pad

I'm trying to make it so that a string generates n keys, and all of those are required to recover the original string. For this, I generate n-1 random strings, XOR them all together with the original ...
5
votes
1answer
82 views

Basic cryptography algorithm

I wrote 2 classes in order to implement some basic cryptography algorithm. I tried to use some object-oriented concepts of C++. I'm a beginner, so any comment or suggestion is welcome. First class: ...
1
vote
2answers
54 views

More efficient columnar transposition decryption

Below, I have created a rudimentary script to decipher a columnar transposition. I am wondering if there is a more efficient way to determine the number of the rows in a column? Also, is there a way ...
5
votes
1answer
71 views

Hash-based cipher

I've written a cipher class based off of cryptographically secure hash functions and block cipher counter mode of operation. It currently runs around 20MB/s on my machine with the Java implementation ...
4
votes
1answer
59 views

Salsa20 stream cipher

I have been implementing Salsa20 by studying the design and specification. I have made sure to unit test every function along the way and match the outputs against the test vectors in the spec. I am ...
6
votes
1answer
147 views

Bitcoin algorithm BIP0039: Mnemonic code for generating deterministic keys

This is an implementation of BIP0039 in Rust (I used python-mnemonic as a guide). I'd like my first Rust program to be critiqued. I would like to know if the program is structured correctly, if I've ...
4
votes
1answer
106 views

Truncate 160-bit output from SHA-1 to 64-bit uint64_t

I'd like to truncate 160-bit output from SHA-1 to receive a (weaker) 64-bit digest. It has been a while since I did the type of low-level C pointer arithmetic in the but-last line. Could you please ...
7
votes
1answer
58 views

sha1sum implementation in C++

I rarely program C++ in anger, and considered myself somewhat rusty, and certainly not up to speed on C++11. For a bit of exercise, I thought I'd try implementing sha1sum, as wasn't really up to speed ...
6
votes
2answers
2k views

C# AES Encryption

I've been researching AES encryption a bit over the past several days. The official (MSDN) examples I've seen are encrypting and decrypting using the same AES instance. They don't go in to what to do ...
2
votes
1answer
50 views

Encrypting messages using the XOR operation

recently I've started to learn Clojure. I came up with an easy programming problem, described by this C code: ...
8
votes
2answers
93 views

Encoding and decoding small strings of text

This is supposed to encode and decode small strings of text. Unfortunately, even on a really good laptop, it performs slowly. This might have to do with my looping, or just the sheer computation. It ...
5
votes
1answer
102 views

Simple encryption based on MD5

I made a Python 3(.4.2) program that only adds classes and is meant to be imported. It allows the creation of files that store usernames and hashed passwords. It uses salting as well. It also can ...
8
votes
1answer
142 views

C# SHA512 Memory Issue

I need an implementation of PBKDF2 in C#. There is already a class Rfc2898DeriveBytes, but it uses SHA1, and I need SHA512. The problem that I faced with during ...
9
votes
3answers
1k views

Brute force MD5 password checker

I'm trying to create a C# brute force MD5 password checker. If I run it with "test1" without MD5, it completes in 15 seconds. I would like to make it faster, but I'm a c# beginner, and don't know how ...
4
votes
2answers
1k views

Simple password encryption / decryption in C++

The below code is for a simple password encryption/decryption program. The code is working perfectly, but the only thing I want to know from you is if this is good logic. PEND.h ...
10
votes
4answers
1k views

FileScrambler, a command-line file encryption tool

I decided to try my hand at making an encryption utility, which I lovingly call "FileScrambler". FileScrambler allows the user to encrypt a file (a master-password list, personal diary, or whatever) ...
2
votes
0answers
158 views

Simple encryption with PHP 5.5

I want to do simple encryption using PHP 5.5. By “simple” I mean I want to use native PHP functions. I have created this code that works, can it be improved? It's to encrypt/decrypt strings and binary ...
1
vote
0answers
133 views

AES encryption class

I am new to encryption and recently wanted to learn more about it. I researched how to do AES Encryption in java and assembled my own Java AES encryption class. I don't know if there are any major ...
0
votes
0answers
32 views

AES256 + HMACSHA256 'secretbox'

I aim to create a few primitives for creating AES256-then-HMACSHA256 secured session state through cookies. What I've considered: HMAC instead of plain sha to avoid hash extension attacks input ...
3
votes
1answer
209 views

Secure random number generator

I just wrote this function and I was curious if anyone could find any flaws in it. It look pretty secure to me but I just want to make sure since I'm no cryptography expert. ...
1
vote
0answers
110 views

Is this implementation of the ECIES cipher correct?

I downloaded source code of cryptosms and implemented the ECIES cipher in my work for Java mobile. I doubt validity of this step (full code of my method is below): ...
3
votes
1answer
140 views

Transparent encryption of HTML5 storage engine(s)

I am looking for feedback and possible suggestions regarding a piece of JS code that performs transparent symmetric encryption/decryption of user specified data using the HTML5 ...
4
votes
1answer
598 views

Encrypting data on client side and passing it to server side

I'm passing the data to PHP server side which will use the information later as this: ...
7
votes
3answers
4k views

Simple password encryption / decryption

I'm working on a simple data storing program for my senior year (Secondary School / Grade 12), and there is a user sign-in functionality I've decided to implement. The way I've done this is by storing ...
4
votes
1answer
216 views

Polyalphabetic cipher

I am trying to write the simplest to undestand code possible, each function has documentation and examples and I tried to use the best style possible. ...
2
votes
1answer
45 views

Optimizing mcrypt encryption class further

The following is a very simple implementation of an Encryption class using mcrypt whereby the functions encrypt and ...
5
votes
2answers
124 views

Secure password hashing implementation

I'm implementing a password hashing method for a website. The code below is part of the User class. Any pointers on what I could do better? ...
3
votes
2answers
1k views

Encryption with many algorithms using Crypto++

For the last few days I have been working on this code to develop a class that allow me to crypt a block of byte with many algorithme. One block will be divided into three equal blocks and every ...
3
votes
1answer
672 views

Encryption/decryption of a string with a salt

I have a new job coming up soon and want to increase my PHP knowledge. This is my first attempt at creating and using a class. I just want to know if it's the correct way to do things. It's very ...
2
votes
1answer
610 views

BouncyCastle RSA Implementation

This is my implementation of 1024bit(can be changed) RSA. Is there anything I'm doing wrong? ...
6
votes
2answers
328 views

MD5 shuffling with a defined pattern of numbers

I've created a MD5 shuffler with a defined number pattern. Does this make sense? Will this make storing passwords more secure? Is it efficient? ...
4
votes
1answer
70 views

String encryption function in admin section

I have been using this function locally to encrypt strings for example a username. If the user successfully logged in, place the encrypted username into a ...
4
votes
1answer
1k views

BouncyCastle Rijndael 256 Implementation

I modified the implementation from this website to include a salt: ...