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
4
votes
1answer
368 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 ...
4
votes
2answers
518 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 ...
4
votes
1answer
2k 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
123 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 session,...
4
votes
1answer
6k views

Encrypt Using AES

I'm using Microsoft's example for encrypting/decripting a string. In their example, they are using Tripple DES. I'm trying to convert their code to use AES. The modified code, listed below, works. ...
4
votes
1answer
405 views

Hash and check passwords in node.js using the native pbkdf2

I use the native crypto . I use the pbkdf2 and the randomBytes for salting, and the timingSafeEqual to check for the password validity when logging in. I wrote the following functions, based on ...
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 ...
4
votes
1answer
51 views

AES Wrap function

This code is supposed to implement RFC 3394 which also described in this PDF at page 11. Are there any weak places or formatting issues in attached source? Or maybe some places are not explicit ...
4
votes
1answer
296 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 ...
4
votes
0answers
51 views

Node secure randomness implementations

I'm trying to generate secure randomness in Node as a personal challenge. I was wondering if the following implementations are correctly random or they have some flaws. ...
4
votes
0answers
3k views

Generating public/private RSA key pair programmatically, using it for JWTs

In my app I'm using JSON Web Tokens for authentication purposes, using the pyjwt library. Instead of using static keys and/or worrying about key distribution, the server generates a public/private key ...
3
votes
2answers
4k views

Rot -n algorithm in Java

This is a rot-n (rotate n times) encrypt/decrypt algorithm, where n can be any integer (+/-). It's written to encrypt/decrypt all the alphabets (upper/lower case) and leaving behind all non-alphas. ...
3
votes
3answers
10k views

AES encryption in PHP

PHP doesn't have a built-in functions for AES (specifically, AES-128) encoding/decoding, so I've had to implement my own, and this is what I have come up to (of course, taken from different many ...
3
votes
2answers
7k 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
3answers
276 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. ...
3
votes
2answers
896 views

Python image encryption security analysis

I'm currently seeking someone to review the source code for an image encryption program in Python 2.7. The code is complete and should run provided you have installed the correct packages. For this ...
3
votes
2answers
280 views

DIY String Encryption

I was asked to make a String encryption utility without using encryption API. I basically had to come up with my own encryption methodology! the program was to be able to encrypt a string and decrypt ...
3
votes
3answers
329 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
749 views

Cryptographic Extensions

I have created a small crypto extension and I want a deep review of it, such as possible fixes (for hidden problems) and tweaks... 1- Crypto.cs ...
3
votes
1answer
5k 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 ...
3
votes
3answers
285 views

Keyfile Generator

This is a Java program that generates a random keyfile (for OTP, for example). ...
3
votes
1answer
46 views

A Tumbler, or a format-preserving-encryption shuffle

I wanted to implement a simple algorithm for encoding id of entries in a database to avoid: Storing the UID (unique id) in the ...
3
votes
1answer
1k views

Encrypting messages to be sent over a socket

I recognize the importance of properly implement cryptographic functions. Since this is my first time using them I really wanted a second opinion on my method. Therefore, I was wondering if my method ...
3
votes
1answer
1k views

Simple crypto library in Python

Is this code (also available at github with tests, example, and description of algorithms) correct and secure? It follows the recommendations here as far as I can tell. ...
3
votes
2answers
73 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 ...
3
votes
2answers
3k 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 ...
3
votes
1answer
391 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 ...
3
votes
2answers
2k views

Using SQL with encryption

This is my first project I am doing in VB.NET, and also my first real programming project. There is sensitive data, so I am utilizing Microsoft's Encryption/Decryption class (...
3
votes
1answer
6k views

AES-128 encrypt/decipher class

For the past few days I've been working on a AES-128 encrypt/decipher class. I needed something very scaled down from Cryptolib so that I didn't have to constantly ...
3
votes
1answer
991 views

Implementation of Ceaser's Cipher in Python

This is my implementation of a Ceaser's Cipher in Python using OOP principles. I'm looking for feedback for any code starting from the function build_shift_dict (...
3
votes
1answer
116 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 ...
3
votes
1answer
324 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
396 views

Structure and style of Enigma Machine

I took a little time and wrote the following code to produce enigma encryption. I don't normally write code in C so I would like to get feedback on the way it has been structured and any issues a ...
3
votes
1answer
130 views

Code Review of Haskell PBKDF2

Moved from Programmers.SE. I have written a new version of the PBKDF2 algorithm in Haskell. It passes all of the HMAC-SHA-1 test vectors listed in RFC 6070, but it is not very efficient. How can I ...
3
votes
1answer
113 views

Capsulation solution for byte arrays

In a part of the project, I had to implement a solution for encapsulation of byte arrays. We do use ssh and secure ports for socket connection but I was in need of an extra layer of protection against ...
3
votes
2answers
119 views

JSafebox - Encrypted vault - 2nd drill

I am developing JSafebox, a portable safebox project written in Java. A first review have been completed here. The goal is to provide a secured environment where the user can browse encrypted files ...
3
votes
1answer
247 views

Script to encrypt a file and add it to IPFS(ipfs.io)

Here is the script that I would like reviewed for the following: Best practices and design pattern usage Correctness in unanticipated cases The script is made to store (IPFS) Interplanetary File ...
3
votes
1answer
875 views

RC4 implementation

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

AES class security

I am using the AES class (which I think I got from another post on Stack Overflow) for encrypting strings to a database. How robust and secure (would it be easy to break) is this class? Is there any ...
3
votes
2answers
155 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 ...
3
votes
2answers
3k 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 ...
3
votes
1answer
506 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. ...
3
votes
1answer
370 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 ...
3
votes
1answer
159 views

Need Loops for PHP Username/Pass Encryption Script

I've created this PHP script to print a batch of usernames with encrypted passwords locally on my computer because the user/pass format is always the same. username = username password = ...
3
votes
1answer
885 views

File I/O, SHA1 sum and compression

The function hash_blog is inspired by "how git stores its objects". It is supposed to take a String, append a header to it, ...
3
votes
2answers
392 views

Nice design of my hash service class

I would like to know, if my design of this class is good OOP. Should I implement for every hash algorithm a separate class? I'm asking this, because the HashService ...
3
votes
1answer
200 views

WMSAuth implementation

I have to implement WMSAuth in C#: http://wmsauth.org/examples ...
3
votes
1answer
159 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
739 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 ...