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
0answers
13 views

Running this C# Salsa20 code [on hold]

I'm trying to run this code user @scotttyb has posted which is close to this implementation on github. Salsa20 stream cipher implementation ...
3
votes
2answers
41 views

Finding a pair of words from two files with a particular MD5

I have two txt files. Both contain 60k+ words in a list. I put together some code to loop through each file and concatenate the strings ...
5
votes
1answer
148 views

Encryption Algorithm in C#

I'm coding a "encryption" algorithm for learning and and don't know how good is it or how could I make it better: ...
-3
votes
2answers
45 views
5
votes
0answers
80 views

BouncyCastle implementation with X509Certificate signing, KeyStore generation, and Socket creation

The following is a (somewhat messy) implementation of the BouncyCastle cryptography library. I create a self-signed certificate (hopefully correctly), store it in a Java KeyStore, and use it to create ...
0
votes
0answers
21 views

PBKDF2 and HMAC implementation in Scala

First of all: I know that rolling your own cryptographic functions is bad. The SHA256 implementation i use is from Bouncycastle, but i think both HMAC and PBKDF2 are not vulnerable to timing attacks ...
1
vote
2answers
66 views

One Time Pad algorithm for encryption and decryption

I have written my own one time pad algorithm for encryption and decryption, but I would like to listen to your opinions about its correctness and eventually how could I improve it. My idea was to keep ...
1
vote
1answer
80 views

Secure RSA encryption with PyCrypto

I'm coding a very simple reverse shell in python, and I want to encrypt the communication between the server and the client. The idea is to exchange an AES key using RSA then use it to encrypt ...
11
votes
2answers
196 views

Diffie-Hellman in JavaScript

Diffie-Hellman is a key exchange that allows 2 people to share a symmetric key without interaction beforehand. First, a person shares an equation; in this case, we use: $$3^x \mod{17}$$ Next, each ...
7
votes
5answers
649 views

XOR encryption program in C

I've written a program that encrypts files (or stdin) with a user-specified key from 1 to 255. This "encryption" is very insecure, but still a bit better than ROT13 ...
10
votes
3answers
136 views

What an Enigma! (Machine Simulator)

I've made this some time ago for an assignment and I was wondering how it could be improved both in terms of performance and best practices for C code. ...
5
votes
1answer
89 views

Custom encryption

I made a custom encryption library/class which allows to en-/decrypt Strings with a custom charset. I think you'll get what I mean with that when you take a look at ...
4
votes
2answers
186 views

Java conversion of base 16 to base 64

I wrote a solution in Java to solve the problem here. I use BigInteger to convert first from base 16 to base 10, then base 10 to base 64. This seems quite ...
3
votes
1answer
38 views

Sorting dictionary according to letter patterns

I've written a JavaScript dictionary sorting algorithm, which takes a .txt file (the dictionary), and loads it via node's file system. The purpose of this algorithm is to sort every word into its ...
7
votes
1answer
127 views

Encrypt message for sending over non secure network

wRecently needed to swap keys with a colleague on the other side of the country. This script encrypts a file using the other persons public key that is stored on github. It outputs a script that will ...
3
votes
3answers
232 views

Checking an MD5 of a device

The point of this code snippet is to calculate and compare an MD5 obtained from a USB device connected to the computer against a database to check its validity. ...
4
votes
2answers
115 views

BouncyCastle Diffie Hellman

I want to write a complete diffie Hellman example for bouncy castle that includes key generation, key exchange, encryption, and decryption. I also want to verify that if Alice is initiating a ...
5
votes
2answers
98 views

Hashing user passwords

I've written a Java class that will provide the utility of, in essence, hashing user passwords for an Android app that integrates Couchbase mobile into it, and then, checking whether or not the ...
4
votes
2answers
201 views

An AES Cryptography Wrapper

I built this wrapper over the System.Security.Cryptography.Aes encryption/decryption so that one need only instance the class and call the appropriate methods. This makes it much simpler to work with ...
4
votes
3answers
229 views

Cipher decryption and encryption

I'm brand new to C# and I've started to make a cipher decryption program. The code works and runs fine, apart from the odd exception. I'm just looking for ways to improve my code and make more ...
2
votes
2answers
69 views

A hash-signature-type which tests on comparing against normal strings

I decided to throw this together today figuring it would be cool to add to my repertoire. Before we always had performed this "task" externally. Find the value we want to compare, hash it and compare ...
3
votes
2answers
64 views

Program to retrieve key/message from a multiple times used one time pad

I wrote a program to retrieve the key/messages from 10 different ciphers which were all encrypted with the same key with an xor one-time-pad method via crib dragging. To do this, I wrote a python ...
2
votes
1answer
63 views

T-SQL Constant Time Comparison

Explanation is in the function. Please point out any egregious errors: ...
3
votes
2answers
45 views

Getting a hash string for a very large file

After reading about large files and memory problems, I'm suspecting that my code below may be inefficient because it reads the entire files into memory before applying the hash algorithm. Is there a ...
5
votes
2answers
91 views

Simplified DES encryption

This is one of my first Python scripts and I was wondering if it meets the correct conventions. Also are there things that you would write different? I am looking for some good comments so I can start ...
1
vote
0answers
17 views

T-SQL Totp (Rfc6238 SHA2_256) Implementation

Using my previous function as a base I've come up the following: ...
4
votes
1answer
99 views

MD5 hash generator

I made this code for a simple WinForm for my school project where I want to add other hash and encryption algorithms. I have made it following the algorithm of the official RFC 1321 and the Wikipedia ...
2
votes
2answers
92 views

Encryption wrapper

I am writing an encryption class using Crypto++. The idea is that the client connects using RSA (encrypt, decrypt) with username, password, 32 byte key. The server will then return using the stream ...
3
votes
0answers
37 views

T-SQL Pbdfk2 (Rfc2898 SHA2_256) Implementation

Using my previous function as a base I've come up the following: ...
4
votes
0answers
82 views

T-SQL Hmac (Rfc2104 SHA2_256) Implementation

I'm trying to implement an Hmac in T-SQL using this question as an guide. Please critique this: ...
2
votes
2answers
59 views

Encypt XML file with AES and storing on disk

I have written some code to encrypt XML and then store it on the disk. I want to be sure that the encryption code is secure, so here is the code: ...
10
votes
2answers
123 views

Enigma machine simulator

As my first (keep that in mind!) Haskall program (full code at end) I've written a simple Enigma machine and would like feedback on the core code related to its stepping and encoding — stripped of ...
2
votes
1answer
111 views

Secure array encryption and decryption

I have written the below class which encrypts and decrypts a PHP array. The encrypted data and the hash are sent over an insecure connection and I would appreciate if you could check the code for any ...
1
vote
1answer
63 views

Passwords storage class

I'm writing a tool, to manage our application, specifically to store passwords in encrypted view. I made a class which is based on two posts: ...
5
votes
3answers
113 views

Cryptoanalysis of Vigenere-ciphered text with Kasiski test

I am creating a program that will analyse encrypted text using Kasiski examination in order to find possible key length: ...
2
votes
2answers
339 views

Simple stream cipher encryption/decryption function

This is a Python implementation of a stream cipher encryption algorithm. This implementation originates from the one displayed on the TI-Basic wikidot cryptography page. I am well aware that this ...
6
votes
1answer
96 views

Password building and verification

I'm building a library for myself to use to store user passwords. The library itself shouldn't do the retrieval of data, but it should provide container classes for the data. I would like to know ...
8
votes
1answer
173 views

Encrypting a binary stream with RSA + AES in counter mode

I'm writing a little script that encrypts a file using the user's SSH identity. I read the RSA private key from ~/.ssh/id_rsa (default) Use the private key to ...
3
votes
1answer
56 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 ...
16
votes
3answers
673 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
178 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
79 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 ...
10
votes
3answers
1k 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 ...
8
votes
2answers
310 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
74 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
82 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 ...
5
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
162 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. ...
1
vote
1answer
70 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
221 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 ...