The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
-1
votes
3answers
33 views

Implement state eraser for NIST DRBG and other crypto primitives using macro

As a spare-time personal project, I'm implementing a set of symmetric-key cryptographic primitives. One thing I've left vacant for a long time, is the key/state eraser, which I decide to add right ...
6
votes
2answers
181 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. Here is my code; you can run it after having linked with the ...
0
votes
1answer
26 views

Small service for hashing and validating passwords, using PBKDF2

As part of a larger authentication/authorization system, I've developed a small .NET Core 3.0 service for hashing passwords using PBKDF2 (with a salt) and validating passwords against a stored hash/...
4
votes
2answers
66 views

C# Cryptography Interface

C# lacks a common off-the-shelf encryption and decryption interface for dependency injection. Nearly every codebase I've ever opened has a couple of extension methods for hashing strings and so on. ...
5
votes
1answer
70 views

Educational implementation of SHA256 in Rust

A few weeks ago I decided to have a look at the Rust programming language. After a few standard exercises I chose to try to implement the SHA256 hashing algorithm, because why not. The algorithm's ...
3
votes
0answers
35 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 ...
6
votes
2answers
113 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 ...
2
votes
1answer
97 views

kryptein cryptography package for Node.js

I have written a cryptography NPM package called kruptein. The code is also hosted on GitHub. Having used multiple "best practices" with regards to key management, algorithm selection, key size, iv ...
3
votes
0answers
41 views

Atbash cipher in Ruby

I implemented my own spin on the Atbash cipher in Ruby: ...
6
votes
1answer
581 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 ...
4
votes
1answer
94 views

T-SQL Secure String Comparison

The previous version of my function was scalar-valued and employed a WHILE loop to do the comparison, this is SLOW. This new version is tabled-valued and uses a typical tally table in place of the ...
5
votes
1answer
123 views

T-SQL Pbdfk2 (Rfc2898 SHA2_256) Implementation

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

RC4 implementation

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

File encoder/decoder in Nim

I wrote a simple program to encode a local text file with password and decode it back. There is one text file and it is either encoded with a password or is in plain text. I had a version in Python ...
1
vote
1answer
90 views

Expose encrypted serial ID in Elixir

I'm working on a Phoenix/Absinthe application and I thought to expose encrypted sequential IDs instead of UUIDs since these are a bit shorter. Encryption on Elixir/Erlang seems very hard, so I think I'...
2
votes
2answers
74 views

C# Security Module for generating secure hashes

Any pointers on the level of security this hashing function perform at? I have never had to really write my own modules for security before. ...
1
vote
1answer
117 views

Light Security Local-Machine Password Encryption

I have a program that makes a call to an SQL database. I cannot use SSH to connect to it (as far as I am aware) or any other more secure method, so Java's SQL connector was used. As the connection ...
10
votes
4answers
6k views

Encrypt a byte array

This code is a Frankenstein. I found ten examples done in ten different ways and my requirements were slightly different so even if they were reliable they weren't a copy and paste solution. Encrypt ...
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 ...
5
votes
2answers
120 views

PLINQ code analysis in terms of efficiency of cryptographic hashes generation

I have the following code that I wrote in order to find the correct password by generating hashes out of all possible combinations and comparing each of them with the target. I'm trying to make ...
1
vote
2answers
316 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 ...
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 ...
2
votes
0answers
38 views

Difference distribution table for DES

This is my DDT (for DES) code. I just wonder how to be more efficient... I've just started cryptography and I'm not good enough. ...
11
votes
2answers
1k views

Implementation of the Jacobi Symbol in C

I am new to C programming and wrote the following algorithm for the calculation of the Jacobi Symbol. Though there are some faster versions of this algorithm available I am only looking for some ...
3
votes
3answers
330 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 ...
11
votes
2answers
2k views

Employing 3DES algorithm in Java

I am making a project just for fun that employs the 3DES algorithm in Java. I was wondering if my algorithm looks secure. Is there any advice or feedback you could give me? Do I need to include an IV? ...
3
votes
0answers
60 views

SHA256 implemented in Rust

I just finished making an implementation of a SHA256 hashing function (https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) in Rust and I was looking for some feedback. As far as I can tell it ...
4
votes
1answer
67 views

PRBHA-10: A hashing algorithm in Python

So I've been working on a simple little hashing algorithm for Python that I like to call PRBHA-10 for short, or Pseudo-Random-Based Hash Algorithm. This is a hash algorithm in Python that is meant to ...
7
votes
0answers
50 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 ...
7
votes
2answers
119 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 ...
1
vote
1answer
91 views

employing AES algorithm in Java

I have employed an AES algorithm in order to encrypt files within a GUI. I was wondering if my algorithm is secure. Could I change anything to improve it? Is my IV secure and is it producing different ...
3
votes
0answers
52 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 ...
15
votes
1answer
206 views

Security audit of open-source, RSA Blind Signature library

I've just published a small library implementing the RSA Blind Signature process. Here's the GitHub repo! I needed something portable, and easy enough to use that I could ask other people to ...
4
votes
2answers
88 views

F# wrapper to generate SHA256 signature for a file

I've created the following module to allow me to generate a SHA256 signature for a file. (In real life this is used to verify an image file hasn't been amended). The cut down code looks like this: <...
2
votes
0answers
16 views

RC4 in Sinclair BASIC; Working around one-indexed arrays

This is a program written in Sinclair BASIC (48 BASIC) for the Sinclair ZX Spectrum. It uses a hardcoded key (null right now) as seen in the bottom and outputs a stream of integers generated with RC4. ...
0
votes
1answer
162 views

Cryptographically secure token generation in C#

Is the following a cryptographically secure way to generate a random token? Does it have any of the predictability risks that are theoretically associated with using a GUID as a token? ...
1
vote
1answer
432 views

RSA wrapper written in Kotlin

I've written up a small wrapper for RSA and AES encryption in Kotlin, and I want to make sure I'm not making any glaring mistakes before use it. This is going on a small project with basically no ...
4
votes
2answers
5k 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 ...
3
votes
1answer
250 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 ...
2
votes
1answer
43 views

Encrypts using AES GCM for data with limited visibility and long rest

This is the third iteration of my venture on creating an encryption/decryption solution. I asked a question here, which led to this question here, which led to this answer here, which led me to ...
5
votes
2answers
27k views

Hiding $_GET variables using encryption

I use the following functions to encrypt my $_GET variables (whenever I can't easily get away with using $_POST or some other ...
1
vote
1answer
51 views

Encrypts using AES with random initialization vector meant for data with limited visibility and then long rest

I've done some research, reviewed countless SO questions that appeared similar, leading me to endless rabbit holes. My solution is working, but I don't like it. I want to create a random IV for AES ...
4
votes
1answer
892 views

Naïve RSA decryption in Python

I am making a code with basic RSA encryption/decryption. My professor wants me to speed up this function but it is already so simple and I am lost. Any ideas? ...
5
votes
2answers
180 views

Python AES-CBC implementation using AES-ECB

I am looking for ways to make this code more "pythonic" and any issues with my implementation. This was designed to solve Crytopal's Challenge 10. This challenge requires recreating the AES-CBC cipher ...
5
votes
1answer
40 views

High performance wrapper for CSPRNG arc4random(3)

This function is a wrapper for arc4random(3), a cryptographic pseudo-random number generator on macOS and BSDs, but you can also get it by installing ...
5
votes
4answers
1k views

Encryption algorithm for an app

I have created an encryption algorithm for this app I am currently in the process of developing. I was wondering if my code looks "sharp", concise, and most importantly, succinct. I was also wondering ...
15
votes
3answers
17k views

RSA algorithm implementation in Python 3

First, a reminder of the RSA algorithm and what my program implements: Take two distinct, large primes p and q Ideally these ...
2
votes
0answers
116 views

Python RSA/DSA File Cryptography, Key Generation, Key Protection

I have forked a previous version of my script, critiqued here: Generate public/private keys, encrypt, decrypt, sign, verify This program allows you to encrypt and decrypt raw files using RSA keys ...
8
votes
3answers
192 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 ...
1
vote
1answer
144 views

Using encryption/hashing to create a secure login

I am creating a login for an encrypted chat application which retrieves login information from a MySQL database. I have got to the point where I feel pretty confident that (to the best of my knowledge)...