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

learn more… | top users | synonyms (1)

2
votes
1answer
12 views

Steganographic message hiding

This code hides a message in an image by altering the blue values in the top left part. This is just for fun as I think it would be easy for a cryptographer to find and decrypt this. Original With ...
0
votes
0answers
23 views

Implementing DES algorithm in PHP on linux [closed]

I wrote this PHP script trying to implement DES algorithm. I'm running it on terminal, not browser, with php des.php AAAAAAAA AAAAAAAA Here the script ...
14
votes
3answers
593 views

Enigma machine simulator - improving recursive algorithm performance

I'm new to Haskell and am confused by why my code seems to preform so poorly, and wonder if there's something I've not grasped about the coding philosophy behind the language, or the best way to take ...
5
votes
1answer
39 views

Salsa20 stream cipher implementation

I have implemented the Salsa20 stream cipher as an ICryptoTransform. It runs fairly fast and has successfully encrypted and decrypted all of my tests. I would ...
3
votes
1answer
56 views

PHP password encryption algorithm

I've written a password encryption algorithm in PHP, which (I think) is not very vulnerable to rainbowtable attacks. It's just that I don't have a lot of experience with encryptions, nor PHP. But from ...
9
votes
3answers
910 views

AES implementation

We are using an outdated 3DES algorithm for encryption and I have been tasked with writing a new implementation using AES with a 128bit shared secret. I would like to know if there are any security ...
7
votes
2answers
286 views

Password hashing and matching

I took information from a series of posts and some prior knowledge to implement the following hashing algorithm. However, there is a lot of talk about what implementations are secure and not secure. ...
3
votes
0answers
33 views

Mifare AES-128 symmetric key diversification

I have implemented a symmetric (AES 128-bit) key diversification algorithm for Java following the NXP Notes. It works as expected but am not the best Java programmer around, I guess I have done quite ...
4
votes
1answer
68 views

Rvalue copy and and assignment for secure array class [closed]

I have a C++03 library with lots of classes. I'm interested in trying to take advantage of Rvalues and move semantics under C++11 for two or three critical classes. Once of the critical classes is a ...
3
votes
3answers
2k views

Secure Encryption Algorithm

The algorithm gets the number associated with each char, then adds a random number to it and saves the numbers it added. I plan to make an ...
4
votes
2answers
50 views

Matasano CryptoPals Problem 8: Detecting ECB encryption

For the Matasano CryptoPals Challenges Set 1 Problem 8, which states: In this file are a bunch of hex-encoded ciphertexts. One of them has been encrypted with ECB. Detect it. ...
0
votes
1answer
51 views

Encryption via multiplication of hex-converted, multiplied ASCII values

The idea behind the encryption is that it stores the key within the final encrypted password. When the user inputs a password for the first time, they also have to pick an element from a list of ...
3
votes
3answers
212 views

Simplifying Cryptography Key Generation without Losing Security

I am writing a helper class for encrypting string and other data types. My goal is to make it as easy as possible to use, while still keeping a substantial amount of security. One issue I struggled ...
7
votes
2answers
201 views

User Password Encryption in C#

I am maintaining an old codebase of one of our legacy .Net applications which has a component that encrypts and decrypts user passwords using symmetric key cryptography. Since cryptography is not my ...
10
votes
5answers
2k views

Enigma Machine Simulation

This is an Enigma Machine Simulator written in Java: Enigma.java ...
1
vote
2answers
48 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 ...
11
votes
1answer
137 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 ...
1
vote
0answers
34 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
102 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
176 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
1answer
77 views

Vulnerability of Encryption class using 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
61 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
135 views

Python mnemonic ↔ hex conversion (Bitcoin BIP39) - follow-up

Original question: Python PBKDF2 using core modules 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 Bitcoin ...
4
votes
1answer
158 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
132 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
76 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 ...
3
votes
1answer
151 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
1k 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
992 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
450 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
277 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
143 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
86 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
65 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
76 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
73 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
160 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
112 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
72 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
3k 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
54 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
108 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
122 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
158 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
2k 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
174 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
162 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 ...
1
vote
0answers
35 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 ...