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
95 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 ...
3
votes
1answer
577 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 ...
3
votes
1answer
11k views

Encryption/decryption of a string with a salt

I have a new job coming up soon and want to increase my PHP knowledge. This is my first attempt at creating and using a class. I just want to know if it's the correct way to do things. It's very ...
3
votes
2answers
224 views

TreeShell PRNG and Encryption Algorithm Review

I've always wanted to come up with my own algorithm for encryption. Last evening I started writing "TreeShell" encryption algorithm that uses bit shifting and XOR operations on the bit level to do ...
3
votes
0answers
55 views

SHA256 implemented in Rust

I just finished making an implementation of a SHA256 hashing function (https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) in Rust and I was looking for some feedback. As far as I can tell it ...
3
votes
0answers
48 views

File Encryption using pynacl

I need a rather simple file encryptor/decryptor in Python, after some research, I decided to use tye pynacl library reading the file in blocks, writing them back out, and then at the end using Blake2b ...
3
votes
0answers
37 views

Atbash cipher in Ruby

I implemented my own spin on the Atbash cipher in Ruby: ...
3
votes
0answers
93 views

Verify OpenSSL RSA signature (PHP) with .NET (VB)

I would like to achieve something I believe is pretty standard: A) My VB.NET client (ideally targetting Framework 4.0) sends a text string to my Apache/PHP Server via an HTTPS POST request. B) My ...
3
votes
0answers
224 views

ECDH implementation in python (part 3)

After the first and second part, the primary feedback I got was to rename a lot of my variables as I used the same name for different local variables which is really confusing. I tried to hotfix that, ...
3
votes
0answers
1k 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. <...
3
votes
0answers
566 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 ...
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 ...
3
votes
0answers
563 views

AES encryption class

I am new to encryption and recently wanted to learn more about it. I researched how to do AES Encryption in java and assembled my own Java AES encryption class. I don't know if there are any major ...
3
votes
0answers
262 views

Streamed encrypt then MAC construction

I've been porting python Keyczar to work under 2to3 conversion (Github). I wanted to consolidate its streaming AES encrypt/decrypt backend interface with its string decrypt/encrypt. So I wrote a new ...
3
votes
2answers
202 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 ...
2
votes
2answers
211 views

Is my cipher secure?

This is a program that I made for encrypting text files, it uses a one time pad cipher to encrypt the files, but I do not know if there are any holes in my program that could be a vulnerability. <...
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
777 views

Linear Feedback Shift Register

I haven't found any implementation in C# of the LFSR so accordling to Wikipedia i have implment it to myself. https://en.wikipedia.org/wiki/Linear-feedback_shift_register My implementation accept ...
2
votes
2answers
4k views

Modular exponentiation optimisation in Java

As part of an assignment in Cryptography I've been asked to write code that involves calculating modular exponentiation. The BigInteger modPow is not allowed in this case, we have to implement it ...
2
votes
2answers
65 views

Checking hash and passwords with a wordlist, more efficient

I have done a small code in which with a wordlist (out68.lst) I get the passwords from the hashes in the file 'shadow3'. ...
2
votes
2answers
74 views

C# Security Module for generating secure hashes

Any pointers on the level of security this hashing function perform at? I have never had to really write my own modules for security before. ...
2
votes
2answers
2k views

C# AES256 CBC Implementation

I was looking for a proper implementation of the AES256 encryption in C# but didn't find anything I was entirely satisfied with, so I decided to take this opportunity to write a class myself and maybe ...
2
votes
2answers
1k 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 ...
2
votes
2answers
7k views

Encrypt/decrypt PHP function

I have to protect really sensitive information and I have to do it both ways: encryption and decryption. How safe is it? ...
2
votes
2answers
179 views

Incremental sha256sum computation

I ran across an interesting computation for a sha256sum that did not rely on the openssl or crypto libraries pdfcrack/sha256.c. The only difficulty with either of the functions (...
2
votes
2answers
886 views

Twofish implementation in C++

I have implemented the Twofish algorithm in C++ with an OOP approach, separation of concerns and RAII idiom for the session keys and S-boxes. I have also followed Bruce Schneier's advice and my ...
2
votes
2answers
368 views

Change random methods without losing too much performance

I have a class in C# that uses a Random object to get a list of numbers randomized from an array of 1-25. Now what I need is improve this method to use ...
2
votes
1answer
6k views

XECryption encryption and decryption script

The encryption script: ...
2
votes
1answer
7k 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 ...
2
votes
1answer
159 views

T-SQL Constant Time Comparison

Explanation is in the function. Please point out any egregious errors: ...
2
votes
2answers
882 views

1024 bit key generation in php

I want to use this function to store 1024 bit keys in my Mysql database. If you call generateKey(128), you'll get a 128 byte string, same as 1024 bit string. I want to know if there is something wrong ...
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 ...
2
votes
3answers
6k 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
1answer
646 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 ...
2
votes
2answers
603 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: ...
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 ...
2
votes
2answers
4k 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 ...
2
votes
1answer
105 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: ...
2
votes
1answer
1k views

JavaScript xor function

I made simple JavaScript xor function. It accepts string, numeric array and mixed array (char, string, num) as params. It returns string or an array. Returning an array is a must!. All numbers are ...
2
votes
1answer
90 views

kryptein cryptography package for Node.js

I have written a cryptography NPM package called kruptein. The code is also hosted on GitHub. Having used multiple "best practices" with regards to key management, algorithm selection, key size, iv ...
2
votes
1answer
75 views

Crypto for a funny contest with friends

I am participating in a funny crypto contest with my friends. This time, we raised the bar quite a bit. The code below is my take for the constraints we set. Note that on my machine, the code works ...
2
votes
1answer
400 views

Home-grown encryption/decryption function

I know what you are thinking, it's never a good idea to roll your own encryption functions, but I'm doing this for fun and self-learning. I created a function that allows you to send a string as a ...
2
votes
1answer
607 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
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. :) ...
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
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) ...
2
votes
1answer
2k 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
2answers
229 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 ...
2
votes
1answer
62 views

Optimizing mcrypt encryption class further

The following is a very simple implementation of an Encryption class using mcrypt whereby the functions encrypt and ...
2
votes
1answer
1k views

User name and password validation in a MVP application

In a WinForms application I'm doing the password validation as follows: When the user presses the OK button after entering username and password, an event will be fired and the listener in the ...