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
3
votes
1answer
282 views

Cryptopals Challenge 1.6 Solution in Golang

This is my solution to challenge 1.6 from Matasano/NCC Cryptopals. Here is my repository so the code can be cloned/ran and the bitutils/futils code can also be looked at if necessary (I've created ...
4
votes
2answers
189 views

Basic Crypto for .NET

Please tell me if I'm doing this right, and what else is needed to make this hardened. It seems like it's too simple, like there's almost nothing I'm actually doing. For example, there are 4 or 5 ...
6
votes
2answers
3k views

Encrypting files in a directory (AES)

I am quite new to Python (and programming in general). I was trying to create a command-line program for encrypting my files. Please tell me what I can improve (styling, crypto, etc.) Disclaimer: I ...
1
vote
1answer
977 views

Hash password and verify password with Node's Crypto

I would like to make a safe way to store hashes of user passwords and verify them later. Here is crypt.js: ...
14
votes
1answer
7k views

MD5 implementation in C++11

I'm writing a C++ implementation of the MD5 hashing algorithm based on the pseudocode of this wikipedia article. ...
5
votes
1answer
988 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 ...
1
vote
1answer
566 views

Unit test for the right kind of cryptography key

I have a quite large unit test case for one class that currently does not exist, I am going to write it after finishing the test case. I am wondering if my unit test doesn't lack something important, ...
2
votes
1answer
376 views

Encryption in C#

I have got to my self these two functions (Encryption and Decryption): ...
1
vote
1answer
3k views

Play Fair Cipher Implementation

I have implemented a play fair cipher. The code works fine but I would like to improve the clarity and/or performance of the code. First a quick description of how it works. You are given a string to ...
8
votes
3answers
4k views

Generate cryptographically secure random numbers in a specific range

A project I'm working on requires generating a random number of \$N\$ length to a very high degree of fair distribution between digits \$[0, 9]\$. That said, I used the ...
1
vote
1answer
923 views

encrypt/decrypt person data

Ahead of the General Data Protection Regulation (GDPR) I begin to crypt more than ever before, in fact, all I can crypt become crypt. However, I wonder if anybody can tell me if this code is secure ...
1
vote
1answer
265 views

Custom password hashing

I have been creating a class for users on my account. OOP and classes are not my strong point. Below is an extract from my class which I use to create a hash (that will be stored in a database) and ...
1
vote
1answer
128 views

AES Java security

I am new to security and I was wondering if I can make my program better by changing or adding something to make it better/secure. Should I use a keyGenerator? I have my doubts from my program output....
4
votes
2answers
954 views

Simple hashing and salting algorithm

I have devised what I feel to be a simple hash/salting algo for Java, and am looking for some feedback from people more skilled than myself. Please find below my code; ...
2
votes
0answers
630 views

Wrapper/abstraction for encryption and decryption using OpenSSL

I am a beginner when it comes to cryptography and OpenSSL. I have written a short wrapper of some functions in OpenSSL as well as a test of this wrapper, copied below. Specifically, this code is ...
4
votes
1answer
1k views

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 ...
7
votes
1answer
175 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 <...
7
votes
2answers
669 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 ...
5
votes
1answer
3k 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
3k 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
800 views

RC4 implementation

I am using the following implementation of the RC4 encryption algorithm in C# ...
4
votes
2answers
532 views

Generate a Bitcoin Address and the Wif from a phrase

Is there a way to speed up my Python code? ...
6
votes
1answer
652 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
108 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 ...
6
votes
1answer
2k 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
224 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
109 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 ...
9
votes
1answer
1k 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 ...
2
votes
1answer
1k 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/...
1
vote
4answers
2k 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
377 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
101 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
585 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: ...
2
votes
0answers
40 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
167 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 ...
8
votes
1answer
305 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 ...
3
votes
0answers
948 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. <...
2
votes
1answer
2k 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
115 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
82 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
290 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
710 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
926 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
193 views

Some kind of encryption in C++

It's my university task. Can I get some opinions on it? ...
1
vote
1answer
720 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 ...
3
votes
1answer
227 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
1answer
299 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
2k 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
3k 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
2k 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) ...