Skip to main content

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
10 votes
3 answers
542 views

Faster and cleaner SHA-1 leading zero histogram with Python

I've written a python code for finding the distribution of the leading zeros of SHA-1. Using random inputs and hashing-then-counting. Normally it is expected to fit the ...
kelalaka's user avatar
  • 235
10 votes
2 answers
664 views

Can this secure, random generator be improved?

This random generator uses cryptographically secure numbers/chars instead of Math.random(). The Javascript code with jQuery works well but I affect clean code ;) It ...
John's user avatar
  • 101
10 votes
1 answer
2k views

XTEA Block Cipher

Usually people recommend to never implement cryptographic algorithms yourself unless you are an expert in the field. This of course makes a lot of sense mainly because there are numerous things that ...
766F6964's user avatar
  • 901
10 votes
1 answer
18k views

AES-128 encryption class

This is the first time I've written a class in Java to do encryption using AES. Since security is involved I would love it if someone could take a look at it and let me know if anything is wrong with ...
Aaron's user avatar
  • 297
9 votes
2 answers
4k views

Data encryption with python

I am just trying to solve one of the puzzle which is explained below: The sentence if man was meant to stay on the ground god would have given us roots after ...
Here_2_learn's user avatar
9 votes
2 answers
1k views

One Time Pad in Python

I'm new to Python, but I really want to get into the swing of doing things the pythonic way. First, does my code follow the pythonic path? Or does it run screaming bloody murder, as it zig-zags ...
thatOneIdiot's user avatar
9 votes
2 answers
30k 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 ...
Sam's user avatar
  • 193
9 votes
2 answers
911 views

RSA c implementation

This is my first attempt to implement a crypto algorithm. I am using C and gmp to interact with big numbers. I am basing my implementation of the RSA algorithm from the book "A handbook of ...
Thelouras's user avatar
  • 193
9 votes
3 answers
772 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 ...
Blue's user avatar
  • 574
9 votes
1 answer
395 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 ...
graememcc's user avatar
8 votes
3 answers
6k views

File encryption with password

I would like to have my C# cryptography code reviewed. I programmed an application that encrypts files with a password (provided by the user). It basically functions as a password manager, on the ...
Mick's user avatar
  • 91
8 votes
3 answers
5k views

Implementing AES encryption in Java

I'm not a security expert, but while checking over our AES implementation for our flagship product, I've noticed some strange things, like the output length having a relation with the input length and ...
Nzall's user avatar
  • 1,538
8 votes
2 answers
3k views

OpenSSL PBKDF2-HMAC-SHAx proof of concept

I have regrettably been away from C programming for a very long time, so I'd like to get a quick code review of a first proof of concept, before I get too far into adding capabilities, using the ...
Anti-weakpasswords's user avatar
8 votes
2 answers
3k views

.NET Core MVC - Future proof Hashing of passwords

I have written a Helper for Hashing passwords in .NET Core. It should have the following constraints: Future proof (It should be possible to upgrade the Hashing Engine to support Legacy and New ...
Christian Gollhardt's user avatar
8 votes
2 answers
1k views

Generating a tabula recta

I want an experienced Haskeller to critique my code and offer changes/suggestions (so I can learn the idioms of the language and culture around Haskell). I've been using a Tabula Recta for my ...
Ixmatus's user avatar
  • 235
8 votes
1 answer
458 views

Securing a file encryption(ECIES) protocol using Scrypt + Inferno

I'm evaluating the security level of a file encryption app, which implements Scrypt and Inferno, in an ECIES context. The encrypted files are either stored on the user's PC/laptop, either sent with ...
Frank's user avatar
  • 81
8 votes
1 answer
17k views

RC4 implementation in C

...
avmohan's user avatar
  • 183
8 votes
3 answers
2k 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 ...
scotttyb's user avatar
  • 121
8 votes
1 answer
451 views

Python mint hashcash token

This is a Python program to mint a hashcash token, but my code is a lot slower than using a library. What is slowing my program down? It takes over 10 seconds to mint a 20-bit stamp, but using a ...
kyle k's user avatar
  • 1,517
8 votes
1 answer
584 views

RC4 in 8051 assembly optimization

I've been playing around with 8051 assembly lately and thought I would make a little project of implementing RC4, since it is pretty interesting and the algorithm doesn't seem too hard. Plus, taking <...
Scott Colby's user avatar
8 votes
1 answer
525 views

Improving the speed of an MD5 implementation from scratch in C++

I wrote an implementation of the MD5 hashing algorithm from scratch in C++, following the original RFC: https://www.ietf.org/rfc/rfc1321.txt . It works as expected, and the outputs match all the test ...
Prashant Sinha's user avatar
8 votes
1 answer
5k views

XOR Encryption, Decryption, and Cracking in Python

I have recently been working through a number of the Cryptopals Cryptography Challenges to try and improve my knowledge and understanding of both cryptography and Python. As five of the first six ...
jess's user avatar
  • 1,378
8 votes
2 answers
277 views

Encrypted safebox

I am developing JSafebox, a portable safebox project written in Java. The goal is to provide a secured environment where the user can browse encrypted files without leaking data on the drive. The ...
ortis's user avatar
  • 165
8 votes
1 answer
2k views

Golang crypto library: security

I've recently put together a library for working with Crypto in Go. I did not roll my own, I'm relying on stdlib for the core parts of this, but I would still like to get this reviewed by some ...
CCooper's user avatar
  • 81
8 votes
1 answer
2k 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: ...
null's user avatar
  • 308
8 votes
1 answer
2k 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 ...
Stefano Palazzo's user avatar
8 votes
1 answer
9k 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 ...
Robin Rieger's user avatar
8 votes
3 answers
754 views

Generate public/private keys, encrypt, decrypt, sign, verify

My program generates public private keys, encrypts, decrypts, signs and verifies, while using AES for the bulk of the data for speed, and encrypts the random key with RSA. Many operations were chosen ...
FodderOverflow's user avatar
8 votes
1 answer
23k 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 ...
JensB's user avatar
  • 295
8 votes
1 answer
599 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 ...
Vanya Zubenko's user avatar
8 votes
1 answer
4k views

Java AES-256 GCM file encryption

I wrote my first file encryption program, that encrypts a file with AES-256 GCM and stores IV and salt prepended to the file content, so it's likely that I did something worse than possible. I ...
ZiXone's user avatar
  • 81
8 votes
1 answer
95 views

Fun crypto problem: Exploiting a vulnerable encryption scheme with Python

I came across a question asked here and here on the Crypto Stack Exchange site, and decided to analyze it as a kind of case study. To demonstrate the concept, I wrote a short python script depicting ...
voices's user avatar
  • 767
7 votes
3 answers
13k 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 ...
Mayur Mohan's user avatar
7 votes
3 answers
115 views

Encrypt and backup folder to email daily, when online

I have a backup script which should backup a folder and send it to email. This should be done once a day. As this is on my laptop which is not online 24/7 I need to check that I am online and can send ...
Tomas Greif's user avatar
7 votes
1 answer
120 views

Embed MD5 digest in a directory path name

My boss needs me to embed the MD5 digest in a file path, but the problem is MD5 contains escape characters. I've already taught about a uc%duc%d... format, but it ...
sandun dhammika's user avatar
7 votes
3 answers
2k views

Creating and searching a dictionary of passwords and MD5 hashes

In this program, I have been asked to read an existing textfile (1324passlist) containing a list of passwords, then create a dictionary file with both the password and MD5 hash of the password on the ...
j_u_l_e_s's user avatar
7 votes
1 answer
2k views

Secure password-hashing in Java

Here is an article on password hashing, along with an implementation. Is this code secure with number of iterations 10000, key length 256 and salt bytes 32? Is there a rule-of-thumb for key ...
Patrick Garner's user avatar
7 votes
1 answer
2k views

Am I using PHP Mcrypt the right way?

I have written a small wrapper class for using PHP Mcrypt for encrypting and decrypting text data. This class generates a salt for hashing the key and encrypts the given data with the generated key ...
Guido Krömer's user avatar
7 votes
2 answers
1k 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 ...
Bruno Vermeulen's user avatar
7 votes
2 answers
927 views

Finding collisions of the first few bits of a SHA-1 hash

My objective is to find a hash collision of my modified hash function. Assuming my modified hash only outputs the first 36 bits of SHA-1. As we know, SHA-1 is a 160-bit hash value, hence, we only need ...
Astral Zhang's user avatar
7 votes
2 answers
3k views

Dictionary brute force on DES encrypted passwords

For a school project I am tasked to decrypt DES passwords. I have sample code provided below and I want to know if this is the best method. Also should I code in error handling for the dictionary ...
Andy's user avatar
  • 583
7 votes
1 answer
721 views

CypherVault - Command Line Password Manager

I have created a Python 3 password manager for API keys and social media passwords on local storage. The script is 500 lines and PEP8/PYLINT compliant, each definition contains a docstring and the ...
litepresence's user avatar
7 votes
3 answers
605 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? ...
Mike D.'s user avatar
  • 252
7 votes
2 answers
2k views

Canonical Python symmetric cryptography example

Python Cryptography Example Last weekend I wrote some code to help people use PyCrypto in a canonical fashion to symmetrically encrypt and decrypt strings and files. By canonical I mean I've followed ...
Asim Ihsan's user avatar
7 votes
1 answer
615 views

HMAC with SHA256/512 in Rust

I've tried as best I can, to implement HMAC as specified in the RFC 2104. This is also my first Rust project, so the chances that rookie mistakes have been made are high. Since I'm fairly new to the ...
user avatar
7 votes
2 answers
17k 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 ...
ßaron's user avatar
  • 95
7 votes
1 answer
1k 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: ...
Kittoes0124's user avatar
  • 1,940
7 votes
1 answer
2k 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 ...
jnm2's user avatar
  • 403
7 votes
1 answer
313 views

Understanding RSA key generation and implementation in Java

Here is an attempt to leverage Java's BigInteger class to implement the RSA algorithm, as well as md5 and sha512 hashing functions to generate keys for what I hope to be strong cryptography. My prayer ...
Jonathan's user avatar
7 votes
1 answer
101 views

Incremental, encrypted backups for git

I would appreciate any review of the following script I recently posted on GitHub (gitcrypto). Most notably, I would be interested in a review of the cryptographic aspects (I am not an expert in this ...
Andrei Borac's user avatar

1
2
3 4 5
11