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
55 votes
3 answers
55k views

Simplified secure encryption of a String

I have two code examples that I wrote for best practices encrypting a string that I'm looking for feedback both in terms of best practices and security. They are both using authenticated encryption. ...
37 votes
6 answers
28k views

AES Implementation in C++

I've implemented AES (128, 192 and 256) in C++ and I'm looking to improve the code to make it not "DIY-crypto-bad", if at all possible. I've also been trying to optimize my code, and so far I've ...
shmoo6000's user avatar
  • 583
32 votes
5 answers
24k views

Tiny Encryption Algorithm (TEA) for arbitrary sized data

The TEA is a very simple encryption algorithm requiring little time and space - perfect for embedded systems. There are extensions to it, and every version has its flaws (WEP was based on it), but ...
Adam Davis's user avatar
21 votes
4 answers
44k 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 ...
user avatar
21 votes
3 answers
550 views

Encryption functions based on mcrypt

I learned here that it is unsafe to design encryption algorithms from scratch. Given that advice, I made a pair of encryption functions based on mcrypt: ...
rsk82's user avatar
  • 379
19 votes
3 answers
1k views

Enigma machine simulator - improving recursive algorithm performance

I'm new to Haskell and am confused by why my code seems to preform so poorly, and wonder if there's something I've not grasped about the coding philosophy behind the language, or the best way to take ...
orome's user avatar
  • 401
19 votes
2 answers
21k views

C# AES + RSA Encryption Implementation

I've put together an AES encryption implementation to solve a set of requirements. I believe that I've met the requirements, but I'd like to see if anyone is willing to review the implementation to ...
cryptography_question's user avatar
18 votes
1 answer
32k views

Self-contained SHA-256 implementation in C

I have been looking for a SHA-256 implementation in C with no dependencies (preferably self-contained in a single C-file) with a permissive license but found none to my liking. Since the Wikipedia ...
nilo's user avatar
  • 579
17 votes
2 answers
16k views

Secure password hashing

I have found a password hashing article and an implementation. Is this code secure if I increase the salt to 64 bytes, hash key size to 128 bytes and the iterations to 10000? Are there ...
SetiSeeker's user avatar
16 votes
3 answers
3k views

A Caesar cipher in Python3

This code basically just does a Caesar cipher on the contents of the variable "s" with a shift of 1. Sorry if the comments on the code don't explain it well. I'm quite new to Python and I'm not very ...
Erik D's user avatar
  • 163
16 votes
2 answers
3k views

ECDH implementation in python

I wrote an implementation of elliptic curve Diffie-Hellman key exchange in python. I would like to know if I could make it faster, cleaner or more secure: ...
Aemyl's user avatar
  • 760
16 votes
1 answer
18k views

MD5 implementation in C++11

I'm writing a C++ implementation of the MD5 hashing algorithm based on the pseudocode of this wikipedia article. ...
nectar_moon's user avatar
15 votes
6 answers
11k views

Small one time pad encryption program

This one time pad encryption program I have written (basically just an XOR "encryption" program) seems to be working fine, compiling nicely (gcc -o ./OTP.c), and doing what it's supposed to. However I ...
youjustreadthis's user avatar
15 votes
1 answer
389 views

Cryptographically-secure super-secret government message transaction machine

-Hello Agent. Are you on a secure line? -Yes, secured. -Good, in 30 seconds the launch codes will be in your e-mail's inbox. You now have the go. Are you ready for the package? -Yes. ...
Alex L's user avatar
  • 5,737
15 votes
3 answers
72k views

Encrypting a string using AES/CBC/PKCS5PADDING

The code below takes a String and encrypts it using AES/CBC/PKCS5PADDING as transformation. I am learning as I go and I have a few questions about my code. Is <...
user230218's user avatar
15 votes
1 answer
342 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 ...
ShapeOfMatter's user avatar
15 votes
1 answer
6k views

Decrypting a substitution cipher using n-gram frequency analysis

This is a solution for the June 2015 Community Challenge: a program that decrypts a monoalphabetic substitution cipher. It's written in Python 3, but should be portable to Python 2 if you use ...
Gareth Rees's user avatar
  • 49.6k
14 votes
5 answers
3k views

Cryptographically Secure Password Generation in C

I am looking for ways to improve my password generation code written in C. This is in the same vein as my code in C++ and Python with many improvements. I am using ...
esote's user avatar
  • 3,770
13 votes
4 answers
5k views

Fast symmetric key cryptography class

I am trying to build a fast cryptography algorithm. The algorithm works fine, but I am worried if there are any potential flaws that might make the algorithm vulnerable to any kind of attack. Here is ...
user avatar
13 votes
4 answers
3k views

FileScrambler, a command-line file encryption tool

I decided to try my hand at making an encryption utility, which I lovingly call "FileScrambler". FileScrambler allows the user to encrypt a file (a master-password list, personal diary, or whatever) ...
Gabe Evans's user avatar
13 votes
2 answers
2k views

A randomized encryption program

I have just created an encryption program with a friend. I wanted to know if anyone here could give me back any feedback on it. Here is how the program works: Imagine you want to encrypt the word '...
Val198765's user avatar
  • 139
13 votes
3 answers
4k views

AES implementation

We are using an outdated 3DES algorithm for encryption and I have been tasked with writing a new implementation using AES with a 128bit shared secret. I would like to know if there are any security ...
Elad Lachmi's user avatar
13 votes
3 answers
17k views

Enigma simulator performance

Here is my implementation of a simple 3 rotor Enigma machine in C++: ...
StuR's user avatar
  • 245
13 votes
3 answers
14k views

Python implementation of SHA1

Here is a implementation of the cryptographic hash function SHA1 written in Python. It does not use any external libraries, only built-in functions. I know that it would be faster to use an external ...
kyle k's user avatar
  • 1,517
13 votes
2 answers
1k views

PHP mcrypt AES encryption wrapper

There are two keys: the main is aes128 and the second is XTEA, used just for randomization of data inside the AES. Randomization is done with secret random key that is not know even if someone knows ...
user avatar
13 votes
1 answer
640 views

.NET 4.5 licensing subsystem using RSA-4096 strong name key, SHA256 signed XML, and assembly signature enforcing

Abstract For the past week I have been looking at taking advantage of the .NET 4.5 improvements to code signing and XML signing to produce a licensing subsystem I can use to license my own products. ...
Drunken Code Monkey's user avatar
12 votes
6 answers
18k views

Enigma Machine Simulation

This is an Enigma Machine Simulator written in Java: Enigma.java ...
user avatar
12 votes
2 answers
3k 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? ...
adot710's user avatar
  • 131
12 votes
4 answers
3k views

Python secrets command-line tool

I'm building a command-line tool that lets you use Python's secrets module. Here are some commands you can run with this tool: ...
code writer 3000's user avatar
12 votes
2 answers
2k views

Baconian Cipher Python Implementation

I have been trying to implement various substitution ciphers in python. I implemented the Baconian cipher using a dictionary in which the plaintext letters are keys and the ciphertext letters are the ...
Palash Nigam's user avatar
12 votes
2 answers
861 views

Password hashing method

I am having some issue to use PHP5 password_hash() function. My server is not supporting it, so I am using a function to hash. Is this one secure? ...
BANNA's user avatar
  • 123
12 votes
2 answers
6k views

Diffie-Hellman in JavaScript

Diffie-Hellman is a key exchange that allows 2 people to share a symmetric key without interaction beforehand. First, a person shares an equation; in this case, we use: $$3^x \mod{17}$$ Next, each ...
AppIns's user avatar
  • 143
12 votes
1 answer
21k views

Secure way to store and load password in app config

I am trying to figure out a good way to store and load a password in the application configuration of my C# application. To achieve this I use the BouncyCastle library and the DPAPI from Windows. To ...
BoeseB's user avatar
  • 378
11 votes
3 answers
2k views

SHA-256 Implementation

I've been working on a byte-oriented SHA-256 implementation for educational purposes. I then tested it using the NIST CAVP tests found here. All tests pass but I would appreciate some feedback from a ...
dRevan25's user avatar
  • 113
11 votes
4 answers
2k views

Homemade cyraz encryption algorithm

The "Cyraz" encryption algorithm was presented on SOPT community. This algorithm makes a cypher using a private key given in byte[] format with any arbitrary ...
Bruno Costa's user avatar
  • 5,566
11 votes
4 answers
17k 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 ...
user875234's user avatar
11 votes
4 answers
8k views

My own SHA-256 code implementation

I'm worried about my code performance. The code I've written is an implementation of SHA-256 using pseudocode from Wikipedia. It works fine, but I want to speed it up. With a buffer of 4096 bytes, I ...
Luis Rossell's user avatar
11 votes
2 answers
2k 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 ...
3nondatur's user avatar
  • 213
11 votes
2 answers
25k views

User Password Encryption in C#

I am maintaining an old codebase of one of our legacy .Net applications which has a component that encrypts and decrypts user passwords using symmetric key cryptography. Since cryptography is not my ...
hyde's user avatar
  • 213
11 votes
1 answer
2k views

Secure client-side encryption of user content

I am working on a pet project of mine which I've recently revived after a year long hiatus. The application is a note-taking application with client-side encryption. If you need an analogy think ...
Oliver Weichhold's user avatar
11 votes
1 answer
14k views

Using System.Security.Cryptography.ProtectedData, do you see any issue with encryption and encoding?

The application needs to keep a secret which is known to logged in windows user. User enters secret in windows form's text box which is read by application. This is in form of ...
Ankush's user avatar
  • 285
10 votes
3 answers
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 ...
Aaron Hall's user avatar
  • 1,568
10 votes
3 answers
4k views

Brute force MD5 password checker

I'm trying to create a C# brute force MD5 password checker. If I run it with "test1" without MD5, it completes in 15 seconds. I would like to make it faster, but I'm a c# beginner, and don't know how ...
n32303's user avatar
  • 293
10 votes
2 answers
443 views

Password hashing and matching

I took information from a series of posts and some prior knowledge to implement the following hashing algorithm. However, there is a lot of talk about what implementations are secure and not secure. ...
Hurricane Development's user avatar
10 votes
3 answers
394 views

What an Enigma! (Machine Simulator)

I've made this some time ago for an assignment and I was wondering how it could be improved both in terms of performance and best practices for C code. ...
Paulo Martins's user avatar
10 votes
2 answers
368 views

Enigma machine simulator

As my first (keep that in mind!) Haskall program (full code at end) I've written a simple Enigma machine and would like feedback on the core code related to its stepping and encoding — stripped of ...
orome's user avatar
  • 401
10 votes
2 answers
374 views

Citadel's VisualEncrypt and VisualDecrypt

I was skimming through this paper out of boredom. On pages 5 and 6, the paper shows a simple encryption/decryption scheme that Citadel uses to obfuscate data. The algorithm basically XORs the next ...
jliv902's user avatar
  • 1,952
10 votes
3 answers
8k views

Generate cryptographically secure random numbers in a specific range

A project I'm working on requires generating a random number of \$N\$ length to a very high degree of fair distribution between digits \$[0, 9]\$. That said, I used the ...
Der Kommissar's user avatar
10 votes
1 answer
8k views

Encrypting strings in Golang

This is a an example application for testing some encryption and decryption functions in Golang. The functions encryptString(), ...
Joseph's user avatar
  • 219
10 votes
1 answer
3k views

MD5 hash comparison for two folders

Using this page for a starting point into comparing MD5 hash values from files in two different folders, I've put something together that outputs either Copied if ...
user4317867's user avatar

1
2 3 4 5
11