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
4
votes
1answer
116 views

(Final)Simple Decryptor/Encryptor

This is my final version of my simpel Decrypter/Encryptor called Dencryptor. This is one of my first Python projects and I think it turned out pretty good. I am using a Caesar cipher right now and I ...
4
votes
0answers
51 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
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 ...
4
votes
1answer
299 views

Plain Java Encryption with Integrity and Authenticity

I spent quite some time and wrote a single class for the purpose of encrypting/decrypting plaintext bytes with a passphrase. The goal is to not have any further dependencies apart from ...
4
votes
1answer
596 views

Tiny Encryption Algorithm implementation in C

I was just looking for a general feedback about this code, which encrypts a file with the Tiny Encryption Algorithm. I'm currently studying C, and I wanted to know if there was anything I could ...
2
votes
1answer
5k views

AES Encryption/Decryption with key

Is this the best way to encrypt/decrypt data? And Is it good to store Generated InitVector and CipherText in database as Base64 String which is converted from byte[]? ...
6
votes
1answer
195 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 ...
6
votes
3answers
2k views

Java AES CBC encryption/decryption

I've looked at multiple examples of Java AES CBC mode encryption but I couldn't find a proper solution that's safe to use. I ended up writing my own utility class. My questions is: Is this code safe ...
2
votes
1answer
386 views

Home-grown encryption/decryption function

I know what you are thinking, it's never a good idea to roll your own encryption functions, but I'm doing this for fun and self-learning. I created a function that allows you to send a string as a ...
10
votes
2answers
3k 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 ...
6
votes
1answer
644 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. ...
2
votes
2answers
170 views

Incremental sha256sum computation

I ran across an interesting computation for a sha256sum that did not rely on the openssl or crypto libraries pdfcrack/sha256.c. The only difficulty with either of the functions (...
4
votes
1answer
88 views

Is it proper to use nested loops a lot in python?

I have a project and I am trying to do a complex cryptographic method. Is it normal to use nested loops a lot? Or Did I miss something? I intend to create a method which tries all strings to find ...
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
313 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: ...
9
votes
1answer
7k 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 ...
3
votes
1answer
1k views

Encrypting messages to be sent over a socket

I recognize the importance of properly implement cryptographic functions. Since this is my first time using them I really wanted a second opinion on my method. Therefore, I was wondering if my method ...
6
votes
1answer
256 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 ...
1
vote
0answers
173 views

RSA Encryption, improving programming practice and code quality?

This was my first go at any kind of encryption in any kind of programming aspect but my application needed some kind of RSA end encryption for my game packets. Uses RSA and diffihelman and runs off 3 ...
2
votes
1answer
65 views

Generating user ids on a random forum website

Will this code be random enough to generate user ids for a website where people can create posts? Would there be a better method other than running this function and validating it doesn't exist in the ...
1
vote
1answer
2k views

Securing access to PHP services from Javascript Ajax calls

I am creating a generic PHP handler, or "dispatcher", for Ajax calls made from Javascript running on the page served by PHP. The handler will take posted data and, depending on a value, decide how to ...
1
vote
0answers
421 views

KDF computation using CMAC with AES (as PRF) using Bouncy Castle C# library

Using bouncy castle .net implementation (version: 1.8.1.0), I am trying to create an encryption key from a known master key using a key derivation function. The NIST Publication 800-108 contains ...
2
votes
2answers
819 views

Twofish implementation in C++

I have implemented the Twofish algorithm in C++ with an OOP approach, separation of concerns and RAII idiom for the session keys and S-boxes. I have also followed Bruce Schneier's advice and my ...
34
votes
6answers
12k 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 ...
5
votes
1answer
313 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
509 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 ...
3
votes
0answers
219 views

ECDH implementation in python (part 3)

After the first and second part, the primary feedback I got was to rename a lot of my variables as I used the same name for different local variables which is really confusing. I tried to hotfix that, ...
0
votes
1answer
141 views

ECDH implementation in python (part 2)

I worked a while on my code I posted here to make it more flexible and hopefully a little bit more secure. My goal is to implement a secure library for elliptic curve cryptography. ...
5
votes
0answers
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 ...
6
votes
1answer
2k views

Basic one way hash to store a password C#

I am storing a password in a database (school coursework so nothing too complicated but I want to challenge myself), I am using a one way hash function, is this suitable? It works I just feel there ...
2
votes
0answers
309 views

Python2.7 Some xor fun

After doing the Cryptopals challanges, which I found scrolling through codereview, and finally being able to solve set1 challenge 6. I decided to have a little xor fun, and make an automated xor ...
2
votes
0answers
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:...
2
votes
2answers
2k views

C# AES256 CBC Implementation

I was looking for a proper implementation of the AES256 encryption in C# but didn't find anything I was entirely satisfied with, so I decided to take this opportunity to write a class myself and maybe ...
2
votes
0answers
271 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
2answers
811 views

Python image encryption security analysis

I'm currently seeking someone to review the source code for an image encryption program in Python 2.7. The code is complete and should run provided you have installed the correct packages. For this ...
5
votes
1answer
5k 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 ...
4
votes
2answers
101 views

Sign an EC2/S3 URL Version 3

From the previous 2 versions: Sign an EC2/S3 URL Version 2 I fixed the comments from the previous version. Most of the code remains the same (so I have split out the new code for review). The main ...
2
votes
1answer
59 views

Sign an EC2/S3 URL Version 2

Follow up on previous review: Sign an EC2/S3 URL I have fixed the previous comments. I have also added the code needed to sign HTTP header fields as part of the request. ...
4
votes
2answers
162 views

Sign an EC2/S3 URL

The other day I found myself trying to walk through the instructions for signing an S3 URL. http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html Not as trivial as the ...
15
votes
3answers
14k 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 ...
15
votes
2answers
1k 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: ...
1
vote
1answer
140 views

Command based Address book app with encryption and store facilities

I'm new to programming. I wrote the following code in python. It's a cmd based address book. ...
4
votes
2answers
129 views

File's encryption tool in terminal

I've created a wrapper for the SimpleCrypt library that allows to easily encrypt/decrypt a string. The application is used this : ...
2
votes
1answer
211 views

Bash - script to encrypt pdf files using pdfencrypt

I wrote a small script to get around the issue when using pdfencrypt on the command line the password is always echoed as well as being saved to the 'history'. <...
2
votes
2answers
753 views

Linear Feedback Shift Register

I haven't found any implementation in C# of the LFSR so accordling to Wikipedia i have implment it to myself. https://en.wikipedia.org/wiki/Linear-feedback_shift_register My implementation accept ...
3
votes
1answer
154 views

My images have secrets A.K.A. the making of aesthetic passwords V.2

This is my implementation of a prng steganography tool written in Python. You can also find the code on GitHub. Steganography is the art of hiding messages in (images, videos or even audio) I've ...
3
votes
1answer
675 views

ChaCha20 Implementation (based on RFC7539)

Rolling my own cryptography in order to better understand the subject and came up with implementation of the ChaCha20 algorithm pasted below. I'm using the test vectors listed in the RFC along with ...
11
votes
4answers
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 ...
12
votes
2answers
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 ...
2
votes
0answers
515 views

Hashing a SecureString in C#

In .NET, the SecureString type exists to prevent leaking secrets in memory. I want to create a hash from the contents of a SecureString, without putting the contents in memory in a place where I can't ...