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
6
votes
1answer
161 views

MCRYPT - are there any flaws or areas for improvement in this class?

I am working on a class for encryption to use on my site. I have read through many examples of these functions and would just like to clarify a few points I have read and check if this code is worthy. ...
6
votes
1answer
12k views

RC4 implementation in C

...
6
votes
1answer
1k views

Encrypting a payload for transmission over HTTP. AES256 with PBKDF2

I've done some reading about implementing AES256 and deriving a key from a password. If I understand correctly: I want to generate a new salt (for the key) and a new IV (for the encrypted message) ...
6
votes
2answers
103 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 ...
6
votes
1answer
707 views

SHA1 hash of every file in a directory tree

I have a few important files that I would like to preserve, so I make multiple backups of them. In order to check their integrity, I decided to write a python script that would help me with this task. ...
6
votes
1answer
570 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 ...
6
votes
1answer
2k views

AES encryption/decryption using pure .NET and streams

I'm trying my hand at simple encryption and decryption. Ideally I'd like to be doing it the 'right' way, ie something secure without doing it in a way that will have a serious hole. I'd prefer to do ...
6
votes
2answers
9k 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 ...
6
votes
1answer
1k views

Basic cryptography algorithm

I wrote 2 classes in order to implement some basic cryptography algorithm. I tried to use some object-oriented concepts of C++. I'm a beginner, so any comment or suggestion is welcome. First class: ...
6
votes
1answer
405 views

Bitcoin algorithm BIP0039: Mnemonic code for generating deterministic keys

This is an implementation of BIP0039 in Rust (I used python-mnemonic as a guide). I'd like my first Rust program to be critiqued. I would like to know if the program is structured correctly, if I've ...
6
votes
2answers
143 views

OpenSSL AES GCM Convenience Wrapper in C

I wrote this code for inclusion in a repository of encryption code examples. The cryptographic primitives in use are required for compatibility with the other code samples. It's been a long while ...
6
votes
1answer
700 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 ...
6
votes
2answers
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 ...
6
votes
1answer
224 views

“Cryptographic” hash function

I don't know much about the design of cryptographic hash functions but despite that I made an attempt for the sake of learning. This is what I got: ...
6
votes
1answer
204 views

Cryptography implementation for a web-based file server

I'm not a dedicated cryptographer, so I'm looking for someone to look over these functions I wrote and let me know if there are any implementation errors leading to security vulnerabilities or just ...
6
votes
1answer
267 views

Encryption/decryption by matrix multiplication in C

I need to encrypt and decrypt text, image and video with a program in C with a matrix. My program is working but it's really slow, how can I improve its speed ? specially for the decrypt part. Each ...
6
votes
0answers
578 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: ...
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 ...
5
votes
2answers
347 views

Encryption program for a messenger app [duplicate]

I am building an encryption program for a messenger app I am developing. I was wondering if the code looks clean and succinct, and at the same times is safe and secure: ...
5
votes
1answer
461 views

Forming word combinations from file

I am looking for ideas to optimize the below code for speed. I'm also looking for some good improvement in execution time. This code reads a text file. The text file has many lines of ASCII text. ...
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 ...
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 ...
5
votes
2answers
671 views

An AES Cryptography Wrapper

I built this wrapper over the System.Security.Cryptography.Aes encryption/decryption so that one need only instance the class and call the appropriate methods. This makes it much simpler to work with ...
5
votes
4answers
3k views

Random Password Generator in C#

Security is a huge complicated subject. What I'm looking for here is three things: The password generating algorithm isn't reversible, meaning that when someone looks at the source code of this ...
5
votes
2answers
5k 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 ...
5
votes
2answers
2k views

Encryption/decryption of data

I'm trying to work with some encryption/decryption of data. It was some hard work for me to get it working with some buffers and what not. This is the code I came up with: ...
5
votes
2answers
154 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
717 views

AES encryption wrapper

After taking into account answers for my questions here and here I created (well may-be) improved version of my wrapper. The key issue was what if an attacker is knowing what is encoded - he might ...
5
votes
1answer
3k views

A Simple Caesar Cipher in Python

I wrote an encryption/decryption algorithm for the Caesar Cipher. It works fine, but I'm curious if there are any constructive critiques, tips, tricks, comments, or advice anyone may have on how the ...
5
votes
1answer
893 views

API Key storage using AES encryption in Java

This class is responsible for storing an API Key and Secret pair. The secret is encrypted with AES in CFB mode, using a key derived from a passphrase, a random salt and a number of rounds of SHA1. An ...
5
votes
1answer
120 views

Clarity of encryption class

I have recently gotten back into development and I am wondering if the script I have just created is clearly documented and easily understandable throughout each step. Is it easy to understand? ...
5
votes
1answer
65 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 ...
5
votes
1answer
138 views

First encryption program

This is the first piece of code that I write that's not just an exercise but a full program I can actually run. Features: Generate random letter/number pairs for each "printable" ASCII character ...
5
votes
1answer
1k views

C++ RSA Implementation

A while ago I wrote an implementation of RSA with C++, that takes in a simple string,encrypts and then decrypts it. It's pretty much the only substantial thing I have written in C++ and while it works ...
5
votes
1answer
535 views

A Public and Private Key generator for RSA

I made an RSA encryption public and private key generator and I would like some feedback. In particular, as this is cryptography related I want to know if I have done anything that might be considered ...
5
votes
1answer
6k views

Encrypt and decrypt a message using AES-256 with GCM mode using Bouncy Castle C# library

Goal: Given a plaintext message and 256 bit key, encrypt (and subsequently decrypt) the message using a 12 byte IV (in this case null bytes for simplicity, should not do this, I know) with MAC of ...
5
votes
1answer
1k views

Simple encryption based on MD5

I made a Python 3(.4.2) program that only adds classes and is meant to be imported. It allows the creation of files that store usernames and hashed passwords. It uses salting as well. It also can ...
5
votes
1answer
5k views

Perform SHA-256 on input

This code is intended to take input as a string, do a SHA-256 hash on the string, and return the result. It works correctly for the standard test vectors (test code included at the bottom). I'm ...
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
1answer
2k views

Using SHA-512 for encryption/decryption

It occurred to me that if SHA2 can be used to derive keys from passwords, then it might as well be good enough to generate random data that can be xored with a plaintext to encrypt and the other way ...
5
votes
1answer
832 views

PyCrypto AES-256 CTR wrapper secure for public use?

I have tried to write a more user-friendly AES CTR wrapper with PyCrypto, but I'm not sure if it's safe enough. I mean, by default there is IV=1 for CTR and in documentation it's said that IV is ...
5
votes
2answers
156 views

Hashing user passwords

I've written a Java class that will provide the utility of, in essence, hashing user passwords for an Android app that integrates Couchbase mobile into it, and then, checking whether or not the ...
5
votes
1answer
3k views

Java program to encrypt files using Shamir Secret Sharing

Shamir's Secret Sharing scheme essentially splits a secret into n parts, at least k of which are needed to recover it. I'm using that to encrypt/decrypt arbitrary files (it's part of a college project)...
5
votes
1answer
4k views

BouncyCastle RSA Implementation

This is my implementation of 1024bit(can be changed) RSA. Is there anything I'm doing wrong? ...
5
votes
1answer
7k views

BouncyCastle Rijndael 256 Implementation

I modified the implementation from this website to include a salt: ...
5
votes
1answer
17k views

DES, Triple DES and AES-128 code in Java

I wrote below code to crypt and decrypt some bytes in three algorithm with Java but I do not know if I wrote them in correct mode or not. Please tell me about truth of code. First class: ...
5
votes
1answer
341 views

Simplified encryption API wrapper for RSA and AES

I'm working on an encryption library to simplify how my team uses encryption for api credentials and receiving encrypted messages from other teams/projects. This code is wrapping java.security and ...
5
votes
1answer
782 views

Custom encryption

I made a custom encryption library/class which allows to en-/decrypt Strings with a custom charset. I think you'll get what I mean with that when you take a look at ...
5
votes
1answer
118 views

Hash-based cipher

I've written a cipher class based off of cryptographically secure hash functions and block cipher counter mode of operation. It currently runs around 20MB/s on my machine with the Java implementation ...
5
votes
2answers
5k views

AES CTR mode using pycrypto

I've implemented CTR mode by myself (only decryption for now), using only AES built-in functions from pycrypto. It means that I'm not supposed to use mode=AES.MODE_CTR. However, I know that using AES....