Questions relating to cryptographic topics such as encryption/decryption and hashing. (Not for use with trivial ciphers.)
2
votes
1answer
113 views
Encryption functions intended for production
I want to know if these encryption functions are ok for a live production application. Based on resources here and here and here I have put together these three functions.
Purpose
This code is for a ...
4
votes
0answers
64 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, ...
5
votes
1answer
92 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 ...
2
votes
3answers
74 views
Implement Transposition cipher in c++
I try to implement the encryption by Columnar transposition.
Input: key_secret and Text_to_encrypt, both of them are in lower.
Output: encrypted_text.
The code works fine but I have some questions:
...
2
votes
2answers
55 views
Simple ActiveRecord attributes encryption in Rails 5+
The task at hand was to ensure that certain columns in the database are encrypted in case the database data is stolen. I have a feeling that a lot can be improved here (naming, DSL, encapsulations) ...
2
votes
1answer
105 views
Signing a String using an identity and trust from a PKCS #12 Bundle
One of the requirements of a third-party SDK I am integrating with is to sign an identifier string with the identity from a p12 certificate. This code loads a p12 certificate from the application's ...
2
votes
1answer
154 views
AES-128 Encryption/Decryption of NSData
I recently found an Objective-C extension on NSData that encodes and decodes data with AES-128. I made an attempt to port this code to Swift 2.2:
NSData+AES.swift
...
0
votes
0answers
51 views
Hashing passwords with crypto in Node.js
Going through my old files today, I found this code which I wrote a year ago after being asked by my professor to create a "secure" encryption, decryption and password hashing functions.
...
2
votes
2answers
106 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 ...
2
votes
2answers
128 views
String Encryption
I was asked to make a String encryption utility without using encryption API
I basically had to come up with my own ecryption methodology! the program was to be able to encrypt a string and decrypt a ...
3
votes
2answers
50 views
AES class security
I am using the AES class (which I think I got from another post on Stack Overflow) for encrypting strings to a database. How robust and secure (would it be easy to break) is this class? Is there any ...
2
votes
3answers
70 views
String hash generator
There is a lot of code duplication because it generates hashes using multiple cryptographic hash algorithms.
How can I improve this code?
...
2
votes
2answers
53 views
Intel® TinyCrypt: AES-128/CTR to encryption/decryption of 2D arrays
I need to encrypt/decrypt 2D arrays (double pointers) using AES-128/CTR using Intel TinyCrypt (written in C). The following are two helper methods to simplify the library usage. Any comments would be ...
3
votes
0answers
65 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 ...
7
votes
1answer
58 views
Steganography with AES encryption
I created a small program that hides arbitrary files in png images using steganography - it encodes the files in the two least significant bits of every channel, so using a 4-channel png we can encode ...
1
vote
0answers
35 views
API with security through a private and public key
I want to make users login into an app. The code on my server serves a "token". This is based on a salt that is saved for each user, the login date, expDate and the ...
8
votes
3answers
161 views
Implementing AES encryption in Java
I'm not a security expert, but while checking over our AES implementation for our flagship product, I've noticed some strange things, like the output length having a relation with the input length and ...
4
votes
1answer
92 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 ...
1
vote
1answer
100 views
CUDA brute force 48 bit key
I have a cryptographic function with two 24 bit keys.
I have two blocks of input and two blocks of output, and want to brute force the keys using CUDA.
Overview:
The function is composed to two ...
0
votes
1answer
62 views
Effective ways to find partial sha1 collision
I need to find 2 different string and compare their hash value. Both string must contain "abc". I looking for the first eight character that are the same and stop. I have been running for more than 24 ...
6
votes
0answers
245 views
Secure way to store and load password in app config
I am trying to figure out a good way to store and load a password in the application configuration of my C# application.
To achieve this I use the BouncyCastle library and the DPAPI from Windows.
To ...
1
vote
0answers
104 views
Simple Java Encryption/Decryption
I am a beginner at Java programming, and I'm always curious about how to make code more efficient or learn what I am doing wrong. I just started learning about cryptography, and this is a simple ...
12
votes
1answer
180 views
.NET 4.5 licensing subsystem using RSA-4096 strong name key, SHA256 signed XML, and assembly signature enforcing
Abstract
For the past week I have been looking at taking advantage of the .NET 4.5 improvements to code signing and XML signing to produce a licensing subsystem I can use to license my own products. ...
3
votes
1answer
29 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 ...
1
vote
2answers
114 views
File-encryption utility application
I made a simple file-encryption utility application for a little school project.
I'm really interested in cryptography, and tried my best while making it.
Can you see it, and give me feedback?
The ...
5
votes
1answer
459 views
Encrypting strings in Golang
This is a an example application for testing some encryption and decryption functions in Golang. The functions encryptString(), ...
0
votes
1answer
141 views
Implementation of authenticated encryption
My application needs to implement authenticated encryption using C#. There is a .NET class called encryptAndAuthenticate, but it is only supported on windows 8 or ...
1
vote
2answers
159 views
Encryption algorithm using CTR mode
I am using CTR mode (it is a cipher in itself) in this code. I just wanted to see what you thought about it before I finish it.
(Yes, I know that the plaintext length and key length must be highly ...
3
votes
2answers
254 views
AES and RSA using javax.crypto
So I am assuming that I did something wrong, and my AES and RSA encryption and decryption classes are insecure. I plan on using them for a larger project, and want to make sure I didn't completely ...
2
votes
0answers
145 views
LockBox TwoFish string encryption and decryption
I'm using TurboPower LockBox for the first time, and using the TwoFish algorithm to first encrypt a password, and later retrieve the password by decrypting the generated hash.
I would like to know ...
1
vote
0answers
68 views
XOR 256 Block Encrypting and Decrypting
I am quite new to Go but have found it to be very useful for my use case (game server).
I have a routine that encrypts/decrypts the game packets which was written in C++ which can be seen here and ...
3
votes
2answers
51 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
...
6
votes
1answer
350 views
Encryption Algorithm in C#
I'm coding a "encryption" algorithm for learning and and don't know how good is it or how could I make it better:
...
-3
votes
2answers
87 views
6
votes
1answer
1k views
BouncyCastle implementation with X509Certificate signing, KeyStore generation, and Socket creation
The following is a (somewhat messy) implementation of the BouncyCastle cryptography library. I create a self-signed certificate (hopefully correctly), store it in a Java KeyStore, and use it to create ...
0
votes
0answers
41 views
PBKDF2 and HMAC implementation in Scala
First of all: I know that rolling your own cryptographic functions is bad. The SHA256 implementation i use is from Bouncycastle, but i think both HMAC and PBKDF2 are not vulnerable to timing attacks ...
1
vote
2answers
387 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 ...
2
votes
1answer
866 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 ...
11
votes
2answers
207 views
Diffie-Hellman in JavaScript
Diffie-Hellman is a key exchange that allows 2 people to share a symmetric key without interaction beforehand. First, a person shares an equation; in this case, we use:
$$3^x \mod{17}$$
Next, each ...
7
votes
5answers
1k views
XOR encryption program in C
I've written a program that encrypts files (or stdin) with a user-specified key from 1 to 255. This "encryption" is very insecure, but still a bit better than ROT13 ...
10
votes
3answers
170 views
What an Enigma! (Machine Simulator)
I've made this some time ago for an assignment and I was wondering how it could be improved both in terms of performance and best practices for C code.
...
5
votes
1answer
179 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 ...
4
votes
2answers
772 views
Java conversion of base 16 to base 64
I wrote a solution in Java to solve the problem here. I use BigInteger to convert first from base 16 to base 10, then base 10 to base 64.
This seems quite ...
3
votes
1answer
57 views
Sorting dictionary according to letter patterns
I've written a JavaScript dictionary sorting algorithm, which takes a .txt file (the dictionary), and loads it via node's file system. The purpose of this algorithm is to sort every word into its ...
7
votes
1answer
193 views
Encrypt message for sending over non secure network
wRecently needed to swap keys with a colleague on the other side of the country.
This script encrypts a file using the other persons public key that is stored on github. It outputs a script that will ...
3
votes
3answers
239 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.
...
4
votes
2answers
391 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 ...
5
votes
2answers
116 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 ...
4
votes
2answers
237 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 ...
4
votes
3answers
459 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 ...