Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions relating to cryptographic topics such as encryption/decryption and hashing. (Not for use with trivial ciphers.)
3
votes
Simplistic C program to encrypt and decrypt a string
Use modern C
gets() has been dropped from the C standard library since C11 (12 years) and was even then considered poor practice.
Consider alternatives like using fgets() for all user input.
Test not …
2
votes
Incremental sha256sum computation
I am looking for is comments on whether my use of the context struct makes sense in the way it is handled, whether there may be some way around having to dynamically allocate the context behind the …
4
votes
Accepted
Tiny Encryption Algorithm implementation in C
Good formatting and layout.
Aside from bug, good code.
Bug?
I'd expect v[1] + delta, v[0] + delta per Tiny Encryption Algorithm.
// Reference code
// for (i=0; i < 32; i++) { …
1
vote
AES Wrap function
Arrays are best indexed with type size_t rather than unsigned. Notice unnecessary mixed int/unsigned types in i<=n. Both should be size_t.
Avoid naked magic numbers. Why 16 in unsigned char B[16]? …
6
votes
RSA c implementation
Invalid code
In while ((x = getc(file)) != EOF), where is x defined? 1
error: 'x' undeclared (first use in this function)
Use of uninitialized object
The pointer mes is passed to mpz_export() without …
6
votes
Cryptoanalysis of Vigenere-ciphered text with Kasiski test
Fatal: Insufficient memory allocation. Buffer is too small by 2 for s[length+1].
char *s = malloc(length);
...
s[length+1] = '\0';
Minor: long will not necessarily will fit in size_t.
long fs …
14
votes
Accepted
Implementation of the Jacobi Symbol in C
.
// short result = 1;
int result = 1;
...
return result;
Cryptography begs for unsigned types
Instead of long, consider the widest unsigned type of uintmax_t or the widest fixed size type: uint64_ …
12
votes
Accepted
Self-contained SHA-256 implementation in C
Nice implementation. Good attention to shift types.
Use bool. Various members, functions are used only in a boolean fashion. Use bool to add clarity to that use. Yet I suppose this goes agains …
2
votes
Encryption and Decryption in C
Avoid unsigned math mistakes
My code works well if I provide a good key, but if the key is bad (plain[i] ± hash < 0)
plain[i] ± hash < 0 is never true. This is an unsigned compare. An unsigned sum …
2
votes
Encrypting file from source AEAD
So I am wondering if there is a proper more correct way to do it.
binary data
An encryption of a file should not assume it is text lacking a '\0'. As a binary file, data may include null charac …