Skip to main content

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

Frequency Analysis & Chi-Squared Test

Following up on my implementation of Cryptopals Challenge 1, this is my solution to Challenge 3. Single-byte XOR cipher The hex encoded string: ...
RubberDuck's user avatar
  • 30.8k
7 votes
1 answer
272 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 <...
Loki Astari's user avatar
  • 95.3k
7 votes
1 answer
1k 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 ...
nukeop's user avatar
  • 79
7 votes
1 answer
7k 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 ...
MrPublic's user avatar
  • 243
7 votes
1 answer
309 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 ...
Loki Astari's user avatar
  • 95.3k
6 votes
3 answers
2k views

Secure Encryption Algorithm

The algorithm gets the number associated with each char, then adds a random number to it and saves the numbers it added. I plan to make an ...
ponoodle's user avatar
6 votes
4 answers
2k views

Vigenere cipher C program

I implemented a Vigenere cipher that preserves case and can also decrypt if you pass the -d argument. Usage is ...
Red's user avatar
  • 171
6 votes
3 answers
10k views

Simple Caesar shifter in C#

I use these in a windows form with fun buttons, I wanted to see what the world thinks of my coding. This is something that I coded about 2-3 years ago, I did change some of the coding when I looked ...
Malachi's user avatar
  • 28.6k
6 votes
2 answers
5k views

Xor encryption in C

Based on this code found on github and the advice given to me on stackoverflow I made this code for the xor in c. ...
link23's user avatar
  • 123
6 votes
2 answers
31k views

Simple password encryption / decryption in C++

The below code is for a simple password encryption/decryption program. The code is working perfectly, but the only thing I want to know from you is if this is good logic. PEND.h ...
Khurram Farooq's user avatar
6 votes
2 answers
484 views

Encryption program for a messenger app [duplicate]

I am building an encryption program for a messenger app I am developing. I was wondering if the code looks clean and succinct, and at the same times is safe and secure: ...
Algorithm_Creator's user avatar
6 votes
3 answers
2k views

Cryptoanalysis of Vigenere-ciphered text with Kasiski test

I am creating a program that will analyse encrypted text using Kasiski examination in order to find possible key length: ...
lolbas's user avatar
  • 223
6 votes
2 answers
414 views

MD5 shuffling with a defined pattern of numbers

I've created a MD5 shuffler with a defined number pattern. Does this make sense? Will this make storing passwords more secure? Is it efficient? ...
user2975652's user avatar
6 votes
2 answers
330 views

How easy is it to crack this encryption algorithm?

When I was about 13 or 14 years old, I was a little interested in cryptography (which is, after all, an interesting field). I learnt quite a lot since that time (it has been about 8 years since then), ...
kono's user avatar
  • 61
6 votes
2 answers
19k views

AES Encryption C# .NET

I have written a tool for encrypting string using the AesCryptoServiceProvider in .NET. The folllowing parameters are used: Block Cipher Mode: CBC Initialization Vector: 16 bytes (randomized per ...
jim's user avatar
  • 283
6 votes
1 answer
473 views

Forming word combinations from file

I am looking for ideas to optimize the below code for speed. I'm also looking for some good improvement in execution time. This code reads a text file. The text file has many lines of ASCII text. ...
goldenmean's user avatar
6 votes
2 answers
14k views

Simple encryption algorithm

I originally made this as a way to use character strings as a base-256 number, but then realized that I could turn it into a method for encryption instead. The only thing is that since I'm using a ...
icdae's user avatar
  • 151
6 votes
2 answers
1k views

Python 3 Vigenere Cipher

I'm still fairly new to Python and I'm trying to see if I've efficiently used modules, functions, etc or if there's another/easier way to do something. This Python 3 Vigenere Cipher is a rebuild of a ...
Chimera.Zen's user avatar
6 votes
2 answers
7k views

HMAC-SHA1 implementation

I am trying out a small piece of code that would generate HMAC-SHA1. I have been asked to code the HMAC implementation myself using the OpenSSL libs for SHA1 calculation. After 'wiki'ing for the ...
user25528's user avatar
6 votes
3 answers
149 views

Idiomatic and performant file hashing

I've written a small program that will accept a directory path and recursively calculate the MD5 hash of each file. ...
etchesketch's user avatar
6 votes
1 answer
140 views

CaesarsCipher Code Quality Concern

I have been following the FreeCodeCamp, and I am done with the basic algorithm challenges. The last one (CaesarsCipher) troubled me a bit, though I had done a similar one without much problem in C, ...
Berk Ozzambak's user avatar
6 votes
1 answer
3k views

Basic one way hash to store a password C#

I am storing a password in a database (school coursework so nothing too complicated but I want to challenge myself), I am using a one way hash function, is this suitable? It works I just feel there ...
Daniel Loudon's user avatar
6 votes
2 answers
4k 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 ...
Daniel's user avatar
  • 4,490
6 votes
2 answers
5k 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 ...
Kolibrie's user avatar
  • 197
6 votes
1 answer
761 views

AES encryption wrapper

After taking into account answers for my questions here and here I created (well may-be) improved version of my wrapper. The key issue was what if an attacker is knowing what is encoded - he might ...
rsk82's user avatar
  • 379
6 votes
2 answers
5k views

AES File Encryption / Decryption

I've been looking for a while for the right code to encrypt/decrypt files with AES in vb.net. I created the code below. Is this the right way doing AES encryption/decryption nowadays? ...
Jp19's user avatar
  • 71
6 votes
1 answer
161 views

Password building and verification

I'm building a library for myself to use to store user passwords. The library itself shouldn't do the retrieval of data, but it should provide container classes for the data. I would like to know ...
blipman17's user avatar
  • 173
6 votes
2 answers
389 views

Selecting an algorithm and key for Java Card encryption

I was playing around with Java Card and I try to do one of the examples. P1 is what it has to do (e.g. decrypt, encrypt, etc) and P2 is to select which key to use in P1. Here is what the code looks ...
Archie's user avatar
  • 63
6 votes
2 answers
3k views

AES implementation in python

For educational purposes, I have implemented the AES block cipher in python. I decided to follow the interface for block cipher modules as defined in PEP 272. The implementation consists of two python ...
Aemyl's user avatar
  • 760
6 votes
3 answers
3k views

Java AES CBC encryption/decryption

I've looked at multiple examples of Java AES CBC mode encryption but I couldn't find a proper solution that's safe to use. I ended up writing my own utility class. My questions is: Is this code safe ...
user avatar
6 votes
3 answers
4k 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 ...
texel's user avatar
  • 63
6 votes
1 answer
181 views

MCRYPT - are there any flaws or areas for improvement in this class?

I am working on a class for encryption to use on my site. I have read through many examples of these functions and would just like to clarify a few points I have read and check if this code is worthy. ...
Luke's user avatar
  • 188
6 votes
1 answer
2k views

SHA1 hash of every file in a directory tree

I have a few important files that I would like to preserve, so I make multiple backups of them. In order to check their integrity, I decided to write a python script that would help me with this task. ...
needle's user avatar
  • 63
6 votes
1 answer
3k 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 ...
Interminable's user avatar
6 votes
1 answer
1k views

Basic cryptography algorithm

I wrote 2 classes in order to implement some basic cryptography algorithm. I tried to use some object-oriented concepts of C++. I'm a beginner, so any comment or suggestion is welcome. First class: ...
youyou's user avatar
  • 177
6 votes
1 answer
494 views

Bitcoin algorithm BIP0039: Mnemonic code for generating deterministic keys

This is an implementation of BIP0039 in Rust (I used python-mnemonic as a guide). I'd like my first Rust program to be critiqued. I would like to know if the program is structured correctly, if I've ...
leshow's user avatar
  • 163
6 votes
1 answer
7k views

Encrypting data on client side and passing it to server side

I'm passing the data to PHP server side which will use the information later as this: ...
HelpNeeder's user avatar
6 votes
2 answers
813 views

OpenSSL AES GCM Convenience Wrapper in C

I wrote this code for inclusion in a repository of encryption code examples. The cryptographic primitives in use are required for compatibility with the other code samples. It's been a long while ...
Luke Park's user avatar
  • 255
6 votes
1 answer
102 views

Node secure randomness implementations

I'm trying to generate secure randomness in Node as a personal challenge. I was wondering if the following implementations are correctly random or they have some flaws. ...
Daniel Reina's user avatar
6 votes
1 answer
239 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: ...
MaiaVictor's user avatar
  • 1,101
6 votes
1 answer
307 views

T-SQL Pbdfk2 (Rfc2898 SHA2_256) Implementation

Using my previous function as a base I've come up the following: ...
Kittoes0124's user avatar
  • 1,940
6 votes
1 answer
2k views

Encrypt texts, with saved password using pycrypto

I have the code bellow, which is supposed to be used inside a larger program. Please see notes about the requirements below the code. ...
oz123's user avatar
  • 497
6 votes
1 answer
215 views

Cryptography implementation for a web-based file server

I'm not a dedicated cryptographer, so I'm looking for someone to look over these functions I wrote and let me know if there are any implementation errors leading to security vulnerabilities or just ...
lightray22's user avatar
6 votes
1 answer
565 views

Encryption/decryption by matrix multiplication in C

I need to encrypt and decrypt text, image and video with a program in C with a matrix. My program is working but it's really slow, how can I improve its speed ? specially for the decrypt part. Each ...
Jilu's user avatar
  • 63
6 votes
0 answers
490 views

Bash script for pull-mode backups via restic's rest-server

I wrote the following Bash scripts to make pull-mode backups with restic, a backup solution written in Golang, similar to Borg Backup. The main use case for this script is pulling backups into a ...
andrew-e's user avatar
  • 353
5 votes
4 answers
1k views

Encryption algorithm for an app

I have created an encryption algorithm for this app I am currently in the process of developing. I was wondering if my code looks "sharp", concise, and most importantly, succinct. I was also wondering ...
Algorithm_Creator's user avatar
5 votes
5 answers
3k 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 ...
user avatar
5 votes
2 answers
139 views

PLINQ code analysis in terms of efficiency of cryptographic hashes generation

I have the following code that I wrote in order to find the correct password by generating hashes out of all possible combinations and comparing each of them with the target. I'm trying to make ...
JustArchi's user avatar
5 votes
2 answers
28k views

Hiding $_GET variables using encryption

I use the following functions to encrypt my $_GET variables (whenever I can't easily get away with using $_POST or some other ...
nathan hayfield's user avatar
5 votes
4 answers
5k 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 ...
the_endian's user avatar
  • 1,343

1 2
3
4 5
11