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
7
votes
1answer
148 views
+50

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 than counting. Normally it is expected to fit the ...
1
vote
1answer
310 views

Password hashing (PBKDF2) and RSA encrypt + AES 256 in Java

Here's what I could comprehend in C code: Generates a key using PBKDF2 Generates an IV which is MD5 of PBKDF2 key in step #1 Does AES-256 encryption on customer-id - which is one of the output RSA ...
7
votes
1answer
213 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 ...
3
votes
1answer
64 views

Simple Password Generator Feedback

This is my first major project in F#, looking for any critique on how I can make it more standard or more concise. Some things I feel like I could have done better are the command flag parsing and the ...
1
vote
1answer
40 views

Caesar Cipher, done in Ruby

It's an assignment from the Odin Project. Here's my implementation: ...
6
votes
1answer
2k views

Encrypt texts, with saved password using pycrypto

I have the code bellow, which is supposed to be used inside a larger program. Please see notes about the requirements below the code. ...
5
votes
1answer
1k 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: ...
2
votes
0answers
29 views

SHA-256 implementation in JS (core codes)

As told by experts, I am re-posting the code review request with the code. Brief Description: from outside sha256() will be called with parameter having UTF-16 character set. then after prepareData()...
5
votes
2answers
6k views

HMAC-SHA1 implementation

I am trying out a small piece of code that would generate HMAC-SHA1. I have been asked to code the HMAC implementation myself using the OpenSSL libs for SHA1 calculation. After 'wiki'ing for the ...
0
votes
1answer
50 views

Python extended Euclidean algortihm + inverse modulo

I programmed the extended Euclidean algorithm together with the inverse modulo because I am making an RSA system from scratch. Any feedback regarding efficiency etc. is welcome :) ...
4
votes
2answers
66 views

Encrypting file from source AEAD

I am trying to encrypt/decrypt file using source code directly. The issue is how to properly do it after reading the file. ...
1
vote
2answers
51 views

Mail Crypt Library for encrypted email [REVISION]

This is a revised copy of the Mail Crypt library based on the recommendations from the last post, as well as reviewing recommendations from the first post that I misunderstood. [Last post] Mail Crypt ...
2
votes
1answer
50 views

Mail Crypt CLI encrypted email wrapper for Gmail

I've spent the past few days writing a python based client that allows you to locally encrypt your message and send it through Gmail. The encryption scheme is based off of hybrid RSA/AES encryption, ...
1
vote
2answers
53 views

Securely implementing AES/RSA hybrid crypto with PyCryptodome

I wondering if anyone could give me feedback on whether or not this is a secure way to implement AES/RSA hybrid encryption and signatures in python 3 with the PyCryptodome module. All of the encoding ...
0
votes
0answers
15 views

A register of government decrees, authenticated with blockchain and public key cryptography (2)

This is a follow-up question to this question, having carried out some of the advise kindly provided by other users. The full repo is here, but I'll post the most important extracts below. ...
4
votes
0answers
47 views

Automatically encrypting text editor

I have written an automatically encrypting text editor (github link). The reasons that I wrote this program instead of using vim + gpg are: It's more convenient than vim + gpg (user only needs to ...
2
votes
1answer
29 views

A register of government decrees, authenticated with blockchain and public key cryptography

The full repo is here, but I'll post the most important extracts below. Background I'm trying to get the hang of blockchain and public key cryptography, so I thought it would be fun to create a ...
10
votes
3answers
2k views

Secrets management, operational security, keeping API tokens hidden while streaming

I've taken up code streaming and I'm concerned that as I do so, I'll leak an API token somewhere. It was suggested that I use something like "a secrets.toml or secrets.yaml or secrets.json file." But ...
2
votes
3answers
116 views

App to Encrypt and Decrypt file

...
6
votes
1answer
81 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. ...
5
votes
1answer
7k 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. ...
3
votes
1answer
53 views

Symmetric decryption with javax.crypto

I'm trying to determine if this code could be a memory hog with huge files. Can anyone tell me if there is anything I can do to make this more memory efficient, or is this how java.crypto works? <...
5
votes
1answer
621 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
586 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 ...
3
votes
1answer
894 views

Secure password hashing implementation with salt and pepper

I share below my password hashing implementation with salt and pepper in C#, for your review and feedback. In my implementation methods like ValidatePassword(), ChangePassword() are in the user class. ...
3
votes
1answer
1k views

ISO mode encryption/decryption with BouncyCastle

I need to implement an ISO-mode encryption/decryption library in C# using BouncyCastle. In this mode, users only need to exchange their RSA public keys to securely communicate. Operation is as follows:...
1
vote
1answer
341 views

Java Crypto library number of padding bytes using PKCS5Padding

I have implemented AES encryption in Java using the following function. What puzzles me is the number of padding bytes added using the PKCS5Padding method. For example, when calling the following ...
3
votes
1answer
152 views

File Encryption using pynacl

I need a rather simple file encryptor/decryptor in Python, after some research, I decided to use tye pynacl library reading the file in blocks, writing them back out, and then at the end using Blake2b ...
4
votes
1answer
91 views

Data encryption / decryption on Node.js

I've implemented my first data encryption / decryption methods on Node.js. Although it might look similar to hundreds of sample implementations available online, I'm curious to get a feedback. I'm ...
5
votes
1answer
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 ...
7
votes
1answer
707 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: ...
7
votes
1answer
74 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 ...
1
vote
2answers
408 views

Encryption scripts using the module cryptography

Its meant to password protect python scripts by using encryption It should use os.urandom(40)'s output in hex as the salt. The kdf (cryptography.io) is using Scrypt ...
6
votes
3answers
3k 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 ...
9
votes
1answer
82 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 ...
2
votes
3answers
195 views

XOR two files together

I am trying to XOR two files each 1Mb which contains only 0 and 1. It works, but I think it is very slow for the C++ program - approximately 4 sec. Could someone, please, suggest the fastest XOR ...
2
votes
1answer
263 views

Java Cryptography AES/GCM/NoPadding without IV

I'm implementing a PAKE-protocol as a university project and one step of the protocol involves sending encrypted data from a key created via a hash function (I'm using SHA-256). I want to use AES/GCM ...
2
votes
2answers
100 views

Encrypt data before sending it to server in a way that makes it unreadable to anyone except the user who sent it

I don't have any experience in cryptography and I've written some crypto code that seem to be working, but I'm not sure if it safe and if the tools and methods I used are right. Objective Make it ...
8
votes
1answer
3k 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 ...
2
votes
1answer
39 views

Custom code for MD5 in js [closed]

I wanted to write my own code for md5 in javascript and learn its inner mechanics. (I know it is not trusted anymore, deprecated, ... but I'm just learning). I didn't want to just copy the code that ...
2
votes
2answers
79 views

A better cryptography process

I am experimenting with cryptography and I was wondering if somebody has some suggestion how I could improve my code and methodology. I want my process to generate more securely the cryptography ...
2
votes
2answers
84 views

Encrypting an AES key

This encryption class RSA encrypts an AES key and then when the encrypt method is called it decrypts the AES key and uses the key to encrypt the message and basically the same thing with the ...
3
votes
1answer
129 views

Crypto createCipheriv and createDecipheriv for authentication

I'm not an expert in authentication, so I want to make sure I have done everything right. I am using crypto.createCipheriv and ...
3
votes
1answer
54 views

Inversionless Lenstra ECM running way slower than it should

So I was coding Inversionless ECM using Prime Numbers: A computational perspective and when I finished and tried running my program it ran way, way slower than it is supposed to. I have no idea what I ...
2
votes
1answer
58 views

Validate implementation of ECIES

I've created a basic implementation of ECIES (Elliptic Curve Integrated Encryption Scheme) based on http://www.secg.org/sec1-v2.pdf section 5.1. ...
7
votes
1answer
161 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 ...
2
votes
1answer
78 views

Berlekamp–Massey Algorithm in Haskell

I was recently tasked to write an implementation of the Berlekamp–Massey algorithm (for GF2) from a given inductional proof and decided to fresh up on my Haskell, since converting a proof by induction ...
2
votes
0answers
73 views

Custom mini cipher

I'm a 14year old and still learning. I know everyone says "don't roll your own crypto", however I decided I must make my own cipher in javascript as soon as I have enough knowledge. I started simple ...
7
votes
1answer
309 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 ...
2
votes
1answer
290 views

Java RSA / AES-GCM encryption utility

I wrote a utility class that has simple methods for: En/decrypting data with 256-bit AES-GCM using a password Generating RSA keypair Saving RSA keypair and storing private key encrypted En/decrypting ...

1
2 3 4 5
9