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
0answers
112 views

T-SQL Pbdfk2 (Rfc2898 SHA2_256) Implementation

Using my previous function as a base I've come up the following: ...
6
votes
0answers
536 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: ...
2
votes
2answers
574 views

Encypt XML file with AES and storing on disk

I have written some code to encrypt XML and then store it on the disk. I want to be sure that the encryption code is secure, so here is the code: ...
10
votes
2answers
275 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 ...
2
votes
1answer
3k views

Secure array encryption and decryption

I have written the below class which encrypts and decrypts a PHP array. The encrypted data and the hash are sent over an insecure connection and I would appreciate if you could check the code for any ...
1
vote
1answer
197 views

Passwords storage class

I'm writing a tool, to manage our application, specifically to store passwords in encrypted view. I made a class which is based on two posts: https://stackoverflow.com/questions/20852664/python-...
6
votes
3answers
854 views

Cryptoanalysis of Vigenere-ciphered text with Kasiski test

I am creating a program that will analyse encrypted text using Kasiski examination in order to find possible key length: ...
4
votes
2answers
5k 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 ...
6
votes
1answer
133 views

Password building and verification

I'm building a library for myself to use to store user passwords. The library itself shouldn't do the retrieval of data, but it should provide container classes for the data. I would like to know ...
8
votes
1answer
2k views

Encrypting a binary stream with RSA + AES in counter mode

I'm writing a little script that encrypts a file using the user's SSH identity. I read the RSA private key from ~/.ssh/id_rsa (default) Use the private key to ...
3
votes
1answer
380 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 ...
19
votes
3answers
917 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 ...
7
votes
3answers
1k views

Salsa20 stream cipher implementation

I have implemented the Salsa20 stream cipher as an ICryptoTransform. It runs fairly fast and has successfully encrypted and decrypted all of my tests. I would ...
3
votes
1answer
116 views

PHP password encryption algorithm

I've written a password encryption algorithm in PHP, which (I think) is not very vulnerable to rainbowtable attacks. It's just that I don't have a lot of experience with encryptions, nor PHP. But from ...
13
votes
3answers
3k 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 ...
10
votes
2answers
404 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. ...
3
votes
0answers
550 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 ...
4
votes
1answer
103 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 <...
6
votes
3answers
2k views

Secure Encryption Algorithm

The algorithm gets the number associated with each char, then adds a random number to it and saves the numbers it added. I plan to make an ...
4
votes
2answers
1k views

Matasano CryptoPals Problem 8: Detecting ECB encryption

For the Matasano CryptoPals Challenges Set 1 Problem 8, which states: In this file are a bunch of hex-encoded ciphertexts. One of them has been encrypted with ECB. Detect it. ...
1
vote
1answer
345 views

Encryption via multiplication of hex-converted, multiplied ASCII values

The idea behind the encryption is that it stores the key within the final encrypted password. When the user inputs a password for the first time, they also have to pick an element from a list of ...
4
votes
3answers
686 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 ...
9
votes
2answers
21k 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 ...
12
votes
6answers
14k views

Enigma Machine Simulation

This is an Enigma Machine Simulator written in Java: Enigma.java ...
2
votes
2answers
3k views

AES-encrypted key store

I am writing a program that needs to retain specific data but that should not be easily readable. I am in no way very skilled in crypto but I wrote this class that takes all of the data in and then ...
14
votes
1answer
4k 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 ...
7
votes
1answer
2k views

Hashing a SecureString using Cryptography Next Generation

Goal: I needed to calculate the salted hash of a password, where the password is stored as a SecureString. There doesn't seem to be much .NET framework support for SecureString. In particular, none ...
8
votes
1answer
20k views

Very simple asymmetric RSA encryption in C#

Based on this: asymmetric encryption in C# I added some more functionality to make it even easier to use (I combined the keySize and the ...
2
votes
1answer
314 views

Vulnerability of Encryption class using AES + HMAC

I've written an encryption-decryption class that is to be used in my companies commercial web application that will handle sensitive information. The encrypted data will be passed over the internet ...
3
votes
1answer
563 views

Recreating binary counter for arbitrary length arrays

After weeks of slaving over FIPS-197, I finally have my own working C/C# implementation of AES-128 which I'm quite happy about. The next thing I'm looking to do is implement a ...
4
votes
1answer
2k 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
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: ...
3
votes
0answers
2k views

Web API 2 - JWT with X509 certificate

I got my JWT generation working with X509 and wanted to ask if you would recommend any changes in respect to: Signing certificate storing / handling. Publishing for anonymous access public key ...
10
votes
1answer
2k 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 ...
5
votes
1answer
2k 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)...
12
votes
3answers
50k 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 <...
4
votes
2answers
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? ...
17
votes
2answers
14k 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 ...
7
votes
1answer
6k views

.Net BouncyCastle - CSR and Private Key Generation

The purpose of this code is to generate the CSR and the Private Key. The scenario is that we have some clients for whom we run websites and for the SSL component we want to have a page on our site ...
3
votes
2answers
3k views

Encrypt string using One Time Pad

I'm trying to make it so that a string generates n keys, and all of those are required to recover the original string. For this, I generate n-1 random strings, XOR them all together with the original ...
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: ...
2
votes
3answers
720 views

More efficient columnar transposition decryption

Below, I have created a rudimentary script to decipher a columnar transposition. I am wondering if there is a more efficient way to determine the number of the rows in a column? Also, is there a way ...
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 ...
4
votes
1answer
274 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 ...
6
votes
1answer
401 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 ...
4
votes
1answer
210 views

Truncate 160-bit output from SHA-1 to 64-bit uint64_t

I'd like to truncate 160-bit output from SHA-1 to receive a (weaker) 64-bit digest. It has been a while since I did the type of low-level C pointer arithmetic in the but-last line. Could you please ...
7
votes
1answer
157 views

sha1sum implementation in C++

I rarely program C++ in anger, and considered myself somewhat rusty, and certainly not up to speed on C++11. For a bit of exercise, I thought I'd try implementing sha1sum, as wasn't really up to speed ...
9
votes
2answers
26k views

C# AES Encryption

I've been researching AES encryption a bit over the past several days. The official (MSDN) examples I've seen are encrypting and decrypting using the same AES instance. They don't go in to what to do ...
2
votes
1answer
103 views

Encrypting messages using the XOR operation

recently I've started to learn Clojure. I came up with an easy programming problem, described by this C code: ...
9
votes
3answers
533 views

Encoding and decoding small strings of text

This is supposed to encode and decode small strings of text. Unfortunately, even on a really good laptop, it performs slowly. This might have to do with my looping, or just the sheer computation. It ...