Questions relating to cryptographic topics such as encryption/decryption and hashing. (Not for use with trivial ciphers.)
3
votes
1answer
22 views
C# Rijndael Compression/Encryption Class
Out of personal interest and as a learning exercise I've written a C# class (.NET 4) to perform encryption/decryption of a file along with some compression upon encryption. Most of my understanding of ...
5
votes
0answers
57 views
Linux/Mac hashing SHA-1
To do password exchange on the SQL server I need to use SHA-1 to generate a hash (no plain password exchange).
This is done differently on Linux/Mac so I abstracted it slightly.
ThorCryptWrapper.h
<...
6
votes
2answers
146 views
One Time Pad in Python
I'm new to Python, but I really want to get into the swing of doing things the pythonic way. First, does my code follow the pythonic path? Or does it run screaming bloody murder, as it zig-zags ...
4
votes
1answer
63 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 ...
5
votes
4answers
187 views
Random Password Generator in C#
Security is a huge complicated subject. What I'm looking for here is three things:
The password generating algorithm isn't reversible, meaning that when someone looks at the source code of this ...
1
vote
0answers
38 views
RC4 implementation
I am using the following implementation of the RC4 encryption algorithm in C#
...
5
votes
2answers
101 views
6
votes
0answers
87 views
Golang crypto library: security
I've recently put together a library for working with Crypto in Go.
I did not roll my own, I'm relying on stdlib for the core parts of this, but I would still like to get this reviewed by some ...
1
vote
1answer
26 views
doCrypto method for asymetric key (RSA)
I'm implementing rsa and aes classes in java, but i have some trouble with the rsa implementation.
Since i have two keys in asymetric encryption, with two different types, i've made two differents ...
4
votes
1answer
78 views
AES encryption/decryption using pure .NET and streams
I'm trying my hand at simple encryption and decryption. Ideally I'd like to be doing it the 'right' way, ie something secure without doing it in a way that will have a serious hole. I'd prefer to do ...
6
votes
1answer
165 views
“Cryptographic” hash function
I don't know much about the design of cryptographic hash functions but despite that I made an attempt for the sake of learning. This is what I got:
...
2
votes
1answer
78 views
Need help to make a more secure AES class
I've been working on my first "big" project in java, an AES encryption and decryption class, it's now working but i don't know how to improve my code. Also i'm not the best in security and I have no ...
0
votes
0answers
38 views
Elliptic Curve Digital Signature
I am trying to make a simple signing algorithm using known standards; I used elliptic-curve in this case to make key-size small but still secure.
I appreciate all comments, and especially if you see ...
8
votes
1answer
175 views
Secure client-side encryption of user content
I am working on a pet project of mine which I've recently revived after a year long hiatus. The application is a note-taking application with client-side encryption. If you need an analogy think ...
3
votes
1answer
369 views
Making AES encryption in Go just a little easier
AES encryption in Go is already pretty simple, Gencrypt is a package that acts as a wrapper around Go's standard packages used for AES encryption to make it even more simple.
https://gitlab.com/...
0
votes
0answers
25 views
cryptography routine for stream data
I have code that was taken from a C++ project, I have implemented it in Go but with this line by line re-code comes a few non-optimized parts. Being an encryption routine for incoming and outgoing ...
1
vote
4answers
112 views
Java class to compute and get a MD5 hash as a string
Here is my class file to compute MD5 hashes on a file. I wanted to be able to easily calculate them without having to create a lot of overhead in the code using the class.
Can anyone tell me a list ...
4
votes
1answer
74 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 ...
2
votes
1answer
69 views
Vector-based Null Cipher
Continuing with my series of cipher programs, I hastily wrote a null cipher program, and I was wondering how it could be improved:
...
2
votes
1answer
119 views
Split string into “n” lengths with padding
I quickly wrote a short program to split a string into \$n\$ lengths with variable-character padding:
...
3
votes
0answers
16 views
Symmetric decryption with javax.crypto
I'm trying to determine if this code could be a memory hog with huge files. Can anyone tell me if there is anything I can do to make this more memory efficient, or is this how java.crypto works?
<...
2
votes
0answers
57 views
Locally encrypt/decrypt credentials
I wrote some code to encrypt and decrypt some user credentials for services that a locally run application needs to work.
I get a password from the user, use it to stretch a key via Scrypt, and then ...
7
votes
1answer
63 views
Securing a file encryption(ECIES) protocol using Scrypt + Inferno
I'm evaluating the security level of a file encryption app, which implements Scrypt and Inferno, in an ECIES context. The encrypted files are either stored on the user's PC/laptop, either sent with ...
4
votes
0answers
46 views
Encode object to JSON and encrypt with AES (with tests)
While the task at hand is relatively straightforward, it turned out AES in Go is a bit clunky so I was wondering if this seems right. Also, any tips on Go coding in general are more than welcome.
<...
1
vote
1answer
102 views
Decrypting single byte XOR encryption
The code along with the utils module is also at github. If you'd also have any advice on how the whole crate is structured I'd love to hear it. :)
...
4
votes
0answers
41 views
ECDSA for Mathematica
The code below contains functions related to ECDSA (Elliptic Curve Digital Signature Algorithm) with standard parameters secp256k1. The implementation is based on ...
2
votes
1answer
64 views
Encrypting a user's file with a key that isn't stored but only known by the user
I want to make some kind of file vault. I want to store encrypted files in a MySQL table, and the key to encrypt/decrypt them is never stored but only known to the user (that's the goal, anyway).
The ...
-2
votes
1answer
68 views
Symmetric cipher [closed]
Can someone please review this algo and say if it has some weak places and/or what kind of algo is this (caesar, block etc)?
...
2
votes
0answers
73 views
Converting [UInt32] -> [UInt8] -> [[UInt8]]
I am trying to speed up my current implementation of a function that converts [UInt32] to a [UInt8] which in turn is split up ...
3
votes
1answer
184 views
Implementation of Ceaser's Cipher in Python
This is my implementation of a Ceaser's Cipher in Python using OOP principles. I'm looking for feedback for any code starting from the function build_shift_dict (...
1
vote
1answer
139 views
0
votes
1answer
223 views
Encrypting and decrypting strings using Caesar cipher
I was inspired by a solution in Think Python: How to Think Like a Computer Scientist. I structured mine (into two functions) according to it, and used the technique used in
...
2
votes
1answer
145 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 ...
5
votes
1answer
135 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
159 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
545 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
163 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
362 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
1k 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
68 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.
...
3
votes
2answers
124 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
168 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
83 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
127 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
69 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
283 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
126 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
51 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
226 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
160 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 ...