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
5 votes
2 answers
818 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 ...
Der Kommissar's user avatar
5 votes
2 answers
2k views

SHA-256 Hash with a short string length in javascript

I think I've found a way to somewhat "compress" the length of a SHA-256 hash. I am doing some addition, so I wanted to know whether an approach like this is secure or not. ...
rfl890's user avatar
  • 101
5 votes
2 answers
3k 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: ...
SimonLanghoff's user avatar
5 votes
3 answers
1k views

Caesar Cipher Encryption / Decryption in Python

I'm trying to write a Python program to predict the most likely substitution for a Caesar cipher. I managed to get it working, but it just seems very clunky and slow, especially because I need to ...
tommy2111111111's user avatar
5 votes
2 answers
2k 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 ...
Infuzion's user avatar
  • 153
5 votes
1 answer
4k 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 ...
Plue's user avatar
  • 379
5 votes
1 answer
1k 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 ...
Mark Renouf's user avatar
5 votes
1 answer
3k views

Login system using bcrypt and MySQL, to be used for any future projects

Main function will ask what the user wants to do. LoginSystem class will handle the sign up and login process as well with the checking if password is right. passwordHashing will use bcrpyt to salt ...
drakebakincake's user avatar
5 votes
1 answer
1k 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 ...
AlexV's user avatar
  • 7,260
5 votes
1 answer
16k 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 ...
Raghu's user avatar
  • 163
5 votes
1 answer
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: ...
Wizard Of Ozzie's user avatar
5 votes
1 answer
130 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? ...
Daryl Gill's user avatar
5 votes
1 answer
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) ...
ndsc's user avatar
  • 151
5 votes
1 answer
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. ...
user avatar
5 votes
1 answer
1k views

Rijndael Cipher in C++ (128bit AES)

I am a hobbyist and do not work in the industry, but I do have an interest in programming an cryptography. I decided to have a go at writing a 128bit implementation of AES in C++. This is my first ...
WireInTheGhost's user avatar
5 votes
2 answers
274 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 ...
Evgeny's user avatar
  • 203
5 votes
1 answer
71 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 ...
nalzok's user avatar
  • 513
5 votes
1 answer
168 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 ...
Clepsyd's user avatar
  • 233
5 votes
1 answer
3k 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 ...
falkon13's user avatar
5 votes
1 answer
691 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 ...
user668074's user avatar
5 votes
1 answer
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 ...
user avatar
5 votes
1 answer
6k 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 ...
Jerry Coffin's user avatar
  • 33.6k
5 votes
1 answer
217 views

Hybrid encryption library for text/image encryption (additional feature implementation)

I am coding a hybrid encryption library that utilises AES and RSA to encrypt text/images, The library is working fine however I am wondering if I can make any improvements to it. I have included ...
Vey's user avatar
  • 51
5 votes
1 answer
3k 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 ...
Douglas's user avatar
  • 859
5 votes
1 answer
4k 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 ...
deceze's user avatar
  • 320
5 votes
1 answer
986 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 ...
Peter Badida's user avatar
5 votes
1 answer
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)...
hoodakaushal's user avatar
5 votes
1 answer
5k views

BouncyCastle RSA Implementation

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

BouncyCastle Rijndael 256 Implementation

I modified the implementation from this website to include a salt: ...
schnawel007's user avatar
5 votes
1 answer
19k 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: ...
MIMAD's user avatar
  • 51
5 votes
1 answer
817 views

Encrypting credit card data

I need an encryption algorithm that would be secure enough to store credit card data. So it should be reasonably secure. Here's what I've come up with. I'd appreciate any constructive criticism. <...
Jonathan Wood's user avatar
5 votes
1 answer
460 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 ...
gridDragon's user avatar
5 votes
1 answer
981 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 ...
PreFiXAUT's user avatar
5 votes
1 answer
757 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 ...
Achachi's user avatar
  • 51
5 votes
1 answer
144 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 ...
kag0's user avatar
  • 151
5 votes
2 answers
6k 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....
aaamourao's user avatar
5 votes
1 answer
1k views

Custom password encryption

The point of the program will be to have an file that will hold encrypted passwords which will only be unlocked by the password that encrypted them. I don't plan to use it in any web application/login ...
Feconiz's user avatar
  • 53
5 votes
2 answers
190 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 ...
user89596's user avatar
5 votes
1 answer
256 views

Parallelizing scrypt key-derivation function

To review my use of multiprocessing, I don't think it is at all necessary to understand the algorithm, but it's the scrypt key-derivation function. This uses ...
otus's user avatar
  • 878
4 votes
5 answers
7k views

C++ AES Encryption Class

I am working with OpenSSL and writing an AES256 encryption module. My knowledge of cybersecurity is not vast and I would like to know whether there are any obvious holes I'm leaving. The intent is for ...
kich's user avatar
  • 41
4 votes
2 answers
4k views

Rot -n algorithm in Java

This is a rot-n (rotate n times) encrypt/decrypt algorithm, where n can be any integer (+/-). It's written to encrypt/decrypt all the alphabets (upper/lower case) and leaving behind all non-alphas. ...
cypronmaya's user avatar
4 votes
1 answer
1k 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? ...
Chad T's user avatar
  • 71
4 votes
2 answers
10k views

Encrypting and decrypting passwords in PHP

I am wanting to encrypt a password and decrypt a password using PHP. Is this a safe method? ...
maxisme's user avatar
  • 237
4 votes
3 answers
764 views

Simplifying Cryptography Key Generation without Losing Security

I am writing a helper class for encrypting string and other data types. My goal is to make it as easy as possible to use, while still keeping a substantial amount of security. One issue I struggled ...
Jonathan Wood's user avatar
4 votes
3 answers
6k views

Cipher decryption and encryption

I'm brand new to C# and I've started to make a cipher decryption program. The code works and runs fine, apart from the odd exception. I'm just looking for ways to improve my code and make more ...
James Cook's user avatar
4 votes
2 answers
254 views

New MD5 algorithm

Can you please try my algorithm and give comments or feedback about it? ...
jec's user avatar
  • 41
4 votes
2 answers
9k 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 ...
user avatar
4 votes
2 answers
10k views

Simple stream cipher encryption/decryption function

This is a Python implementation of a stream cipher encryption algorithm. This implementation originates from the one displayed on the TI-Basic wikidot cryptography page. I am well aware that this code ...
Slinky's user avatar
  • 829
4 votes
2 answers
2k views

Hashing passwords for a website

I have spent about 2 weeks reading about hashing passwords and website security. As there seems to be many different ways to achieve this, I'm a bit confused as to whether my code is secure. Can ...
George Phillipson's user avatar
4 votes
2 answers
560 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. ...
Christian Findlay's user avatar

1 2 3
4
5
11