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
2
votes
1answer
204 views

Vigenère decoder/encoder in Python (using matrix)

I made an encoder/decoder for the Vigenère cipher. This one is using a table, not the remainder technique. Please let me know what you think can be done to improve performance, etc. ...
2
votes
1answer
5k views

AES Encryption/Decryption with key

Is this the best way to encrypt/decrypt data? And Is it good to store Generated InitVector and CipherText in database as Base64 String which is converted from byte[]? ...
2
votes
1answer
75 views

Generating user ids on a random forum website

Will this code be random enough to generate user ids for a website where people can create posts? Would there be a better method other than running this function and validating it doesn't exist in the ...
2
votes
1answer
61 views

Sign an EC2/S3 URL Version 2

Follow up on previous review: Sign an EC2/S3 URL I have fixed the previous comments. I have also added the code needed to sign HTTP header fields as part of the request. ...
2
votes
1answer
309 views

Bash - script to encrypt pdf files using pdfencrypt

I wrote a small script to get around the issue when using pdfencrypt on the command line the password is always echoed as well as being saved to the 'history'. <...
2
votes
1answer
493 views

Encryption in C#

I have got to my self these two functions (Encryption and Decryption): ...
2
votes
1answer
2k 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/...
2
votes
1answer
144 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
3answers
839 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 ...
2
votes
1answer
1k views

Ensuring client IDs are unique

I'm writing a node.js application that involves handling clients based on their ID without any real way of confirming that the ID a client says it has is its actual ID. That is, it's possible for a ...
2
votes
1answer
920 views

Better ways of solving the substitution cipher puzzle

here is the puzzle description Your task is to decode messages that were encoded with substitution ciphers. In a substitution cipher, all occurrences of a character are replaced by a different ...
2
votes
1answer
343 views

Cipher and passphrase classes using Java cryptography

I use some basic cryptography in a project of mine. Because I want my application to run cross-platform and because it seems pretty sophisticated I decided to go with the Java Cryptography ...
2
votes
0answers
32 views

SHA-256 implementation in JS (core codes)

As told by experts, I am re-posting the code review request with the code. Brief Description: from outside sha256() will be called with parameter having UTF-16 character set. then after prepareData()...
2
votes
1answer
39 views

Custom code for MD5 in js [closed]

I wanted to write my own code for md5 in javascript and learn its inner mechanics. (I know it is not trusted anymore, deprecated, ... but I'm just learning). I didn't want to just copy the code that ...
2
votes
0answers
74 views

Custom mini cipher

I'm a 14year old and still learning. I know everyone says "don't roll your own crypto", however I decided I must make my own cipher in javascript as soon as I have enough knowledge. I started simple ...
2
votes
0answers
145 views

XXTEA encryption implemented in modern C++

At the company i work we have a system where an user is presented with a question and some alternatives to choose from. The question and answers are generated at runtime. In order to simplify the ...
2
votes
0answers
25 views

RC4 in Sinclair BASIC; Working around one-indexed arrays

This is a program written in Sinclair BASIC (48 BASIC) for the Sinclair ZX Spectrum. It uses a hardcoded key (null right now) as seen in the bottom and outputs a stream of integers generated with RC4. ...
2
votes
0answers
395 views

Python RSA/DSA File Cryptography, Key Generation, Key Protection

I have forked a previous version of my script, critiqued here: Generate public/private keys, encrypt, decrypt, sign, verify This program allows you to encrypt and decrypt raw files using RSA keys ...
2
votes
0answers
721 views

Hashing a SecureString in C#

In .NET, the SecureString type exists to prevent leaking secrets in memory. I want to create a hash from the contents of a SecureString, without putting the contents in memory in a place where I can't ...
2
votes
0answers
749 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 ...
2
votes
0answers
186 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 ...
2
votes
0answers
928 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 ...
2
votes
0answers
2k 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 ...
2
votes
0answers
204 views

T-SQL Totp (Rfc6238 SHA2_256) Implementation

Using my previous function as a base I've come up the following: ...
2
votes
0answers
366 views

Simple encryption with PHP 5.5

I want to do simple encryption using PHP 5.5. By “simple” I mean I want to use native PHP functions. I have created this code that works, can it be improved? It's to encrypt/decrypt strings and binary ...
2
votes
0answers
165 views

AES256 + HMACSHA256 'secretbox'

I aim to create a few primitives for creating AES256-then-HMACSHA256 secured session state through cookies. What I've considered: HMAC instead of plain sha to avoid hash extension attacks input ...
1
vote
4answers
3k 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 ...
1
vote
2answers
1k views

Is my Encryption Module Secure? [closed]

I have a simple encryption module that is used to "encrypt" a text file because it contains some passwords. I only need to encrypt it because I need those passwords in my program (they are used to ...
1
vote
2answers
51 views

Mail Crypt Library for encrypted email [REVISION]

This is a revised copy of the Mail Crypt library based on the recommendations from the last post, as well as reviewing recommendations from the first post that I misunderstood. [Last post] Mail Crypt ...
1
vote
2answers
62 views

Securely implementing AES/RSA hybrid crypto with PyCryptodome

I wondering if anyone could give me feedback on whether or not this is a secure way to implement AES/RSA hybrid encryption and signatures in python 3 with the PyCryptodome module. All of the encoding ...
1
vote
2answers
415 views

Encryption scripts using the module cryptography

Its meant to password protect python scripts by using encryption It should use os.urandom(40)'s output in hex as the salt. The kdf (cryptography.io) is using Scrypt ...
1
vote
3answers
2k 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 ...
1
vote
1answer
196 views

Some kind of encryption in C++

It's my university task. Can I get some opinions on it? ...
1
vote
1answer
374 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 ...
1
vote
1answer
52 views

Caesar Cipher, done in Ruby

It's an assignment from the Odin Project. Here's my implementation: ...
1
vote
1answer
354 views

Cryptographically secure token generation in C#

Is the following a cryptographically secure way to generate a random token? Does it have any of the predictability risks that are theoretically associated with using a GUID as a token? ...
1
vote
1answer
1k views

RSA wrapper written in Kotlin

I've written up a small wrapper for RSA and AES encryption in Kotlin, and I want to make sure I'm not making any glaring mistakes before use it. This is going on a small project with basically no ...
1
vote
1answer
139 views

Nginx cache path function

I have an MD5 hash string: _hash = '743a0e0c5c657d3295d347a1f0a66109' I want to write function that splits passed string to path in nginx cache format: ...
1
vote
2answers
62 views

Decrypt multiple 10Mb files with defined password

One operation of my Android project is to decrypt one file (chosen in a set of ~30 files for pagination1) of ~10 Mb each and I do this with the following: ...
1
vote
1answer
123 views

Expose encrypted serial ID in Elixir

I'm working on a Phoenix/Absinthe application and I thought to expose encrypted sequential IDs instead of UUIDs since these are a bit shorter. Encryption on Elixir/Erlang seems very hard, so I think I'...
1
vote
1answer
385 views

Using encryption/hashing to create a secure login

I am creating a login for an encrypted chat application which retrieves login information from a MySQL database. I have got to the point where I feel pretty confident that (to the best of my knowledge)...
1
vote
1answer
2k views

Securing access to PHP services from Javascript Ajax calls

I am creating a generic PHP handler, or "dispatcher", for Ajax calls made from Javascript running on the page served by PHP. The handler will take posted data and, depending on a value, decide how to ...
1
vote
1answer
343 views

Java Crypto library number of padding bytes using PKCS5Padding

I have implemented AES encryption in Java using the following function. What puzzles me is the number of padding bytes added using the PKCS5Padding method. For example, when calling the following ...
1
vote
1answer
1k 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: ...
1
vote
1answer
1k 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, ...
1
vote
1answer
5k 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 ...
1
vote
1answer
961 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
833 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 ...
1
vote
1answer
366 views

How can this Encryption Class be more secure?

How secure is this encryption? Secondly, is there something I could do to "turn it up a notch" and make it 'more' secure? ...
1
vote
1answer
346 views

Password hashing (PBKDF2) and RSA encrypt + AES 256 in Java

Here's what I could comprehend in C code: Generates a key using PBKDF2 Generates an IV which is MD5 of PBKDF2 key in step #1 Does AES-256 encryption on customer-id - which is one of the output RSA ...

1
5 6 7
8
9