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
369 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
382 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
50 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
277 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
37 views

A simple implementation of the principle of RSA encryption

Inspired by a Numberphile video I made a little program that shows the principles of RSA encryption and decryption. To calculate the keys I used the explanation in this link: rsa public private key ...
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
119 views

ECDSA for Mathematica

The code below contains functions related to ECDSA (Elliptic Curve Digital Signature Algorithm) with standard parameters secp256k1. The implementation is based on ...
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
3k 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
273 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
323 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
837 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
746 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
281 views

Keyfile Generator

This is a Java program that generates a random keyfile (for OTP, for example). ...
3
votes
1answer
45 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
382 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
954 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
394 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
109 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
239 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
839 views

RC4 implementation

I am using the following implementation of the RC4 encryption algorithm in C# ...
3
votes
2answers
561 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
153 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
499 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
369 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
199 views

WMSAuth implementation

I have to implement WMSAuth in C#: http://wmsauth.org/examples ...
3
votes
1answer
156 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
698 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 ...
3
votes
1answer
285 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 ...
3
votes
1answer
227 views

Encryption functions intended for production

I want to know if these encryption functions are ok for a live production application. Based on resources here and here and here I have put together these three functions. Purpose This code is for a ...
3
votes
1answer
94 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 ...
3
votes
1answer
571 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 ...