Questions tagged [implementation]

Implementing a cipher or protocol is the process of taking it from its mathematical or algorithmic description and producing a working version, often in computer software or hardware. This tag should be used for any question discussing the various potential considerations and pitfalls of this process, for example padding.

Filter by
Sorted by
Tagged with
1
vote
1answer
151 views

What are the algorithms used in Facebook's Diem algorithm?

Facebook plan a new cryptocurrency release called Diem. What algorithms are used? What output size is used for the hash function?
10
votes
2answers
1k views

Why do we implement a protocol?

In general, after we design a secure cryptographic protocol and make sure that it is efficient (e.g., through complexity analysis), we implement it. Questions: Do we implement it for proof of concept?...
7
votes
1answer
226 views

Expandable hash function

I have been studying a cryptosystem using Mersenne primes. More specifically, this paper. I have implemented this cryptosystem in Python, but I am missing the key encapsulation system. On page 12, ...
6
votes
2answers
229 views

How does this POLYVAL modular reduction algorithm work?

I recently found the GitHub repository used to make the measurements in the AES-GCM-SIV paper where they implement polynomial hashing using POLYVAL. This means in this context to compute the usual $\...
0
votes
2answers
75 views

CSPRNG in Javascript?

I'm trying to obtain a random, unpredictable quite long number (± 20-25 digits) using Javascript (created by user's client) as fast and light as possible. Is this solution reliable, robust and secure ...
0
votes
0answers
33 views

What's the performance of the HElib and SEAL?

HElib contains the CKKS and BGV, SEAL contains the BFV and CKKS, is there some concrete performance data about these two lib?
1
vote
0answers
58 views

NTRU cryptosystem on complex numbers

Background I am interested in lattice-based cryptography. Recently I got familiar with the NTRU cryptosystem and found out that it can be extended onto hypercomplex numbers, like Quaternions (QTRU) or ...
7
votes
0answers
162 views

How are the constants found in the AVX2 implementation of CRYSTALS-KYBER round 2 generated?

The post-quantum lattice-based cryptosystem CRYSTALS-KYBER which has made it to the second round of NIST PQC includes two implementations: 1) a baseline reference implementation in C and 2) an ...
1
vote
1answer
97 views

What are the algebraic normal forms for each bit of $z$, where $z = (x \oplus y) \oplus ((x \wedge y) \ll 1)$ (a non-linear operation in NORX)?

Let $x, y, z$ denote three $n$-bit words such that $$z = (x \oplus y) \oplus ((x \land y) \ll 1).$$ The NORX paper contains the generalized description of the algebraic normal forms for each bit of $x$...
8
votes
1answer
3k views

What is the proper way to use a client nonce?

I've implemented an API for one of my clients, it relies on nonces and a shared secret. The structure: Client's Site (CS) requests nonce from My App (MA), posting their username MA verifies the ...
2
votes
1answer
64 views

Is a Test Vector feature a Security Hole?

I have a system where a block cipher key (likely AES) is entered via a 'command line' over a serial console, probably as hex. The system has no 'print key' feature, so the key is hopefully 'ingest ...
2
votes
0answers
26 views

Does anybody have test vectors for the LBlock block cipher?

LBlock is a lightweight block cipher with 64-80 bits block-key size, designed by a group of Chinese scholars. Does anybody have LBlock test vectors? I am looking for test vectors, which contain the ...
40
votes
5answers
9k views

In RSA, how does the CPU deal with this huge modulus (8192 bits)?

Whilst I understand how the RSA algorithm works, I don't understand how the CPU operates when it needs to use the mod function with a huge number $n$, for example. ...
0
votes
0answers
19 views

Want to implement a cipher efficiently on Hardware with verilog, is there any standard resources to start?

I want to implement a new block cipher on hardware. The cipher has a look-up table and the rounds are not self-similar. So, the code size, as well as the chip area, is expected to be larger. I just ...
1
vote
0answers
39 views

Multiplication in Tower Field $GF(2^4)^2$

I'm currently reading an article which deals with "Squeezing Polynomial Masking into Tower Fields " for performing an efficient multiplication of elements in $GF(2^8)$. Thereby it is ...
0
votes
1answer
63 views

How does this generate a permutation?

In the process of trying to answer this question, I ended up getting stuck. I found a paper which seems to solve their issue: its authors define a process which yields a pseudorandom permutation ...
3
votes
0answers
54 views

Which parts of CRYSTALS-Kyber and CRYSTALS-Dilithium are compatible?

The papers CRYSTALS-Kyber and CRYSTALS-Dilithium both have been written by quite different authors. It seems that at least the key generation is very different from each other. CRYSTALS mainly seems ...
11
votes
1answer
24k views

What is U2FsdGVkX1?

Using CryptoJS 3.1 I noticed that using 3Des, the encrypted message always start with U2FsdGVkX1 Why is the first part of the encryption always the same? What information does this hold and how ...
4
votes
2answers
301 views

Is FFT for power-of-two cyclotomic rings possible if q is not 1 modulo 2n?

For RLWE (Ring Learning With Errors) scheme, we use $R_{q} = \mathbb{Z}_{q}[x]/(x^{n} +1) = \mathbb{Z}_{q}[x]/(\Phi_{2n}(x))$ where $n = 2^{d}$ for some $d$. Since there exists $2n$-th root of unity ...
0
votes
1answer
56 views

Do I need to implement multi precision arithmetic operations?

I want to implement Elliptic Curves arithmetics (for edu purpose and better understanding) for special NIST primes: point addition, exponentiation, etc.. all operations needed for EC encryption/...
9
votes
3answers
2k views

Benefits of functional programming languages

So far I mostly saw Python (because of simplicity) and C (because of efficiency) for cryptographic programming. But there is a different kind of programming languages called functional programming ...
0
votes
0answers
35 views

Where to get AES GCM NIST-like test cases

I'm implementing AES GCM 256 bit at the moment. Now I'm finished with copying the content of the standard as a program and now have to make it actually work. With the test cases in the official NIST ...
0
votes
2answers
61 views

How to verify most appropriate cleartext?

So basically I was implementing a decryption tool (just for fun) and the first encryption logic I decided to implement was Caesar Cipher. So if I have the input as ...
0
votes
1answer
92 views

Exponentiation Problem of G2 in MNT curve

I made a simple python program in the Charm framework (https://github.com/JHUISI/charm): ...
2
votes
1answer
89 views

Understanding a method of vector multiplication

Recently, I attempted to implement the HQC Post-Quantum KEM in (almost) pure python. In the scheme specification whitepaper, it states the following: Here is a simplified version of the function I ...
1
vote
0answers
62 views

Test vectors for FF1/FF3-1

I'm working on a C implementation of the FF1 and FF3-1 format-preserving encryption algorithms, here. For FF1, NIST provides test vectors, here; however, none of the test vectors is crafted such that <...
0
votes
1answer
50 views

Software implementation of symmetric and asymmetric bilinear pairings

I have recently read a paper about pairings, which only implemented asymmetric bilinear pairings and it mentiond that $\eta_{T}$ pairing is the most efficient algorithm for symmetric pairings. I ...
2
votes
1answer
117 views

How to ensure that a cryptographic implementation is reasonably sound/robust?

I know from the bottom of my heart how bad the idea of custom-crypto is. I absolutely concur with the recommendation that it should only be done by professionals who specialize in implementing crypto ...
1
vote
0answers
69 views

Security of an ECDSA Adaptor Signature Implementation

I'm currently working on an implementation of ECDSA Adaptor Signatures, and part of the signature scheme calls for a NIZK proof to verify knowledge of exponent over two public keys that share a ...
1
vote
1answer
39 views

EdDSA point encoding difference between documentation and implementation

The RFC 8032 describes the point encoding like this : A curve point (x,y), with coordinates in the range 0 <= x,y < p, is coded as follows. First, encode the y-coordinate as a little-endian ...
2
votes
0answers
68 views

Depth of $\operatorname{SHA-256}$ implementation by fan-in $2$ and fan-out $1$ Boolean circuits?

A fan-in $2$ and fan-out $1$ Boolean circuit is a circuit consisting of $\operatorname{AND}$, $\operatorname{OR}$ and $\operatorname{NOT}$ gates where number of inputs to $\operatorname{AND}$ and $\...
4
votes
4answers
1k views

How was AES Encryption cracked on my app?

I built an app that used AES encryption with 16 characters Key and IV. It seems it could easily be hacked, as someone did it in a day. I feel that I made a few mistakes Used key & IV which was ...
0
votes
2answers
69 views

AES Implementation for Image Encryption

I've been delving into cryptography for fun and trying to implement a visualization for AES using image encryption. So far, represented each pixel's RGB values as hexadecimal numbers, then split it ...
1
vote
1answer
70 views

Has Burdges and De Feo's concept of Delayed Encryption ever been implemented?

In mid 2020 Jeffrey Burdges and Luca De Feo published a paper proposing a trapdoor-less time-lock puzzle called Delay Encryption. Has a prototype of this ever been made?
5
votes
1answer
3k views

What is the 'Version Incompatibility" Problem in TLS 1.1/1.2 and 1.0?

It's unclear to me if there are multiple problems, or a single one, (and just what that problem is) with servers incorrectly negotiating down from a client offering 1.1 or 1.2 to something they ...
3
votes
1answer
5k views

How to create a PEM file for storing an RSA key?

I have an RSA private key $\{d,n\}$ and a public key $\{e,n\}$, where $n$ is the modulus, and I also have the prime factors $p$ and $q$ of $n$. I want to create a PEM file containing this information,...
5
votes
1answer
1k views

Generating a random point on an elliptic curve over a finite field

I have coded an implementation of elliptic curves in order to apply some of the ECC algorithms. However, in most of them, Alice needs to choose a point P on a given curve. What is the general ...
2
votes
0answers
68 views

Is this “AND” implementation safe against side channel attacks?

I found out that the following is a working implementation of calculating an AND function between XOR masked shares, implementation at Github. It works by calculating parities, whose terms cancel each ...
2
votes
1answer
984 views

Padding for the TEA

Having finally figured out how to implement the Tiny Encryption Algorithm in C++, I wonder what to do about padding the key and the plaintext. I know that there are various ways of doing this, but is ...
2
votes
2answers
143 views

How to handle modular arithmetic with regard to two's-complement negative numbers?

The reason for asking, is that this occurs in real life with CRT calculation of RSA decryption/signing. In CRT RSA, there's the need to calculate subtraction, and it's known negative numbers could ...
0
votes
1answer
53 views

Can Hash Functions take fixed-size input?

I‘ve argued for quite some time with a friend about wether or not this C# method can be qualified as a Hash Function. ...
5
votes
2answers
312 views

Recommendation of lightweight RNG for Miller-Rabin primality test

Miller-Rabin tests the compositeness of candidate numbers (hence, input $x$) that's often used as a primality test. The M-R test requires different random numbers for accuracy and confidence in the ...
0
votes
1answer
51 views

Creating SHA256 constant values on the fly without memory usuage

Is it possible to create the constants used in SHA256 on the fly? Meaning I dont have to reserve 64 32-bit words of space? It would result in a slower implementation, but at the profit of using less ...
1
vote
0answers
29 views

For most applications of CMS, does the size of the payloads ever exceed that of a 32-bit integer?

For my hobby cryptography project, I'm planning to implement some helper functions that parses a subset of ASN.1 BER encoding without using a ASN.1 compiler. For this purpose, I'd like to use 32-bit ...
2
votes
4answers
291 views

Proof of number of logins in last N days without saving login times

Let's say we have an user Bob. User Bob logs in into our web application every so often. We are a website that tries to save as little information about our users, however we'd like to know which ...
3
votes
2answers
6k views

How to perform file encryption using 128-bit AES

I am confused. How can I encrypt a file using 128-bit Advanced Encryption Standard? Do I need only to encrypt the file name and it's content or is there something that I need to do to encrypt it? Is ...
1
vote
1answer
143 views

How to map output of hash algorithm to a finite field

I would like to know an algorithm hash to a finite field. I have an $l$ bit prime number $q$. I want setup a hash function $H: \{0,1\}^* \to \mathbb F_q$ but I do not know how I can do it. I use a ...
1
vote
1answer
101 views

Implementation of ECC operations in BMR

I want to implement computing ECC operations (i.e., multiplication) in a BMR scheme (secure multi-party computation) What is the best way to do it? I found Fairplay MPC - to allow BMR computation ...
4
votes
1answer
2k views

Additional Data in AEAD (Chacha20-poly1305 libsodium)

I have recently been playing with Chacha20-Poly1305 in libsodium, and all of the examples state the additional data portion of the tag is stored in plaintext when encrypted. But from what I can tell ...
1
vote
2answers
2k views

Why do these Python XTEA implementations require different deltas?

I once needed to an XTEA snippet to from C++ to Python and it did not work properly. I then found a function on ActiveState.com and noticed that it looks almost exactly like mine, with one exception - ...

1
2 3 4 5
10