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
3k views

Is this password hashing acceptable for a custom MembershipProvider?

I'm creating a custom MembershipProvider for an ASP.NET MVC5 application and am wanting to know if this code is acceptable for creating hashed and salted passwords. ...
4
votes
1answer
654 views

Reducing repetitive Android code

How can I reduce the amount of repetitive code in my Android app? A lot of the code seems to be doing the same thing twice. I think that there is a more compact way to do this. What are some ways ...
4
votes
1answer
2k views

Am I using crypt and mcrypt well in this simple encryption class?

These days I read a lot here on SO about password hashing and data encryption. It's a real mess, I mean, deciding what the best practice is. I need a very simple class that can be reused anywhere and ...
4
votes
1answer
1k views

Cryptographic key exchange

I initially posted this on StackOverflow, and was redirected here. I have been playing around with Bouncy Castle (Java) for the last few days, and I've reached the point where I believe I can securely ...
4
votes
2answers
78 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 ...
4
votes
1answer
340 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
2answers
111 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 ...
4
votes
2answers
186 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 ...
4
votes
2answers
580 views

Generate a Bitcoin Address and the Wif from a phrase

Is there a way to speed up my Python code? ...
4
votes
1answer
104 views

Rvalue copy and and assignment for secure array class [closed]

I have a C++03 library with lots of classes. I'm interested in trying to take advantage of Rvalues and move semantics under C++11 for two or three critical classes. Once of the critical classes is a <...
4
votes
1answer
6k views

Encrypting data on client side and passing it to server side

I'm passing the data to PHP server side which will use the information later as this: ...
4
votes
1answer
3k views

How to optimize this Playfair encryption?

For the implementation of the Playfair encryption I needed a custom struct called Cell. This is because I not only need an array of characters I also want to get Elements in a matrix based on their "...
4
votes
1answer
16k views

Playfair Cipher in C++

I have been working on a Playfair Cipher in C++ for a final Project in a Cryptography class. I was hoping for some feedback on the project so far. I recently got a job programming before I've even ...
4
votes
1answer
2k views

A random relative prime number based on the modulus

I am implementing RSA in java using BigInteger and I have a method to return a random relative prime number based on the modulus m. The method looks like this: ...
4
votes
1answer
596 views

Finding a cryptoarithmetic solution

This code is intended to find all possible solutions to a cryptoarithmetic problem. The description of the problem I was trying to solve is here: In cryptoarithmetic problems, we are given a ...
4
votes
1answer
189 views

HKDF and compare constant time in Rust

I have implemented HKDF in Rust, which passes all test vectors from RFC 5869, using HKDF with HMAC-SHA256. I also have a function to compare byte arrays in constant time, which I hope someone could ...
4
votes
1answer
110 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 ...
4
votes
1answer
902 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 ...
4
votes
1answer
308 views

AES Encryption/Decryption

Where I currently work I'm tasked with writing a good encryption and decryption code which will have DEK as well as KEK. Haven't started on KEK yet. I have already told them, that we need expert help, ...
4
votes
1answer
98 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 ...
4
votes
1answer
381 views

MD5 hash generator

I made this code for a simple WinForm for my school project where I want to add other hash and encryption algorithms. I have made it following the algorithm of the official RFC 1321 and the Wikipedia ...
4
votes
2answers
583 views

Encryption wrapper

I am writing an encryption class using Crypto++. The idea is that the client connects using RSA (encrypt, decrypt) with username, password, 32 byte key. The server will then return using the stream ...
4
votes
1answer
3k views

Python mnemonic ↔ hex conversion (Bitcoin BIP39) - follow-up

Original question: Python PBKDF2 using core modules I'm looking for commentary on the following code, which converts from a hex seed to mnemonic (12 word phrase), and vice versa. It's for Bitcoin (...
4
votes
1answer
586 views

AES encryption class

I am new to encryption and recently wanted to learn more about it. I researched how to do AES Encryption in java and assembled my own Java AES encryption class. I don't know if there are any major ...
4
votes
1answer
125 views

String encryption function in admin section

I have been using this function locally to encrypt strings for example a username. If the user successfully logged in, place the encrypted username into a session,...
4
votes
1answer
581 views

Hash and check passwords in node.js using the native pbkdf2

I use the native crypto . I use the pbkdf2 and the randomBytes for salting, and the timingSafeEqual to check for the password validity when logging in. I wrote the following functions, based on ...
4
votes
1answer
400 views

One time key for authentication

In a recent project I was to create a web service that would be consumed by another application. One of the requirements was to have a key in the service that authenticated the request as valid. But ...
4
votes
1answer
51 views

AES Wrap function

This code is supposed to implement RFC 3394 which also described in this PDF at page 11. Are there any weak places or formatting issues in attached source? Or maybe some places are not explicit ...
4
votes
1answer
339 views

Salsa20 stream cipher

I have been implementing Salsa20 by studying the design and specification. I have made sure to unit test every function along the way and match the outputs against the test vectors in the spec. I am ...
4
votes
0answers
47 views

Automatically encrypting text editor

I have written an automatically encrypting text editor (github link). The reasons that I wrote this program instead of using vim + gpg are: It's more convenient than vim + gpg (user only needs to ...
4
votes
0answers
79 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 ...
3
votes
2answers
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. ...
3
votes
3answers
10k views

AES encryption in PHP

PHP doesn't have a built-in functions for AES (specifically, AES-128) encoding/decoding, so I've had to implement my own, and this is what I have come up to (of course, taken from different many ...
3
votes
2answers
8k views

Encryption with many algorithms using Crypto++

For the last few days I have been working on this code to develop a class that allow me to crypt a block of byte with many algorithme. One block will be divided into three equal blocks and every ...
3
votes
3answers
279 views

Checking an MD5 of a device

The point of this code snippet is to calculate and compare an MD5 obtained from a USB device connected to the computer against a database to check its validity. ...
3
votes
2answers
1k 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 ...
3
votes
2answers
298 views

DIY String Encryption

I was asked to make a String encryption utility without using encryption API. I basically had to come up with my own encryption methodology! the program was to be able to encrypt a string and decrypt ...
3
votes
3answers
338 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 ...
3
votes
2answers
756 views

Cryptographic Extensions

I have created a small crypto extension and I want a deep review of it, such as possible fixes (for hidden problems) and tweaks... 1- Crypto.cs ...
3
votes
1answer
6k views

Secure RSA encryption with PyCrypto

I'm coding a very simple reverse shell in python, and I want to encrypt the communication between the server and the client. The idea is to exchange an AES key using RSA then use it to encrypt ...
3
votes
3answers
298 views

Keyfile Generator

This is a Java program that generates a random keyfile (for OTP, for example). ...
3
votes
1answer
58 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 ...
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 ...
3
votes
1answer
1k views

Simple crypto library in Python

Is this code (also available at github with tests, example, and description of algorithms) correct and secure? It follows the recommendations here as far as I can tell. ...
3
votes
1answer
892 views

Secure password hashing implementation with salt and pepper

I share below my password hashing implementation with salt and pepper in C#, for your review and feedback. In my implementation methods like ValidatePassword(), ChangePassword() are in the user class. ...
3
votes
2answers
73 views

Finding a pair of words from two files with a particular MD5

I have two txt files. Both contain 60k+ words in a list. I put together some code to loop through each file and concatenate the strings ...
3
votes
2answers
3k views

Getting a hash string for a very large file

After reading about large files and memory problems, I'm suspecting that my code below may be inefficient because it reads the entire files into memory before applying the hash algorithm. Is there a ...
3
votes
1answer
412 views

Steganographic message hiding

This code hides a message in an image by altering the blue values in the top left part. This is just for fun as I think it would be easy for a cryptographer to find and decrypt this. Original With ...
3
votes
2answers
2k views

Using SQL with encryption

This is my first project I am doing in VB.NET, and also my first real programming project. There is sensitive data, so I am utilizing Microsoft's Encryption/Decryption class (...

1
3 4
5
6 7
9