Generating a random string with a fixed weight

Nir Drucker, Shay Gueron

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review


Generating, uniformly at random, a binary or a ternary string with a fixed length L and a prescribed weight W, is a step in several quantum safe cryptosystems (e. g., BIKE, NTRUEncrypt, NTRU LPrime, Lizard, McEliece). This fixed weight vector selection generation is often implemented via a shuffling method or a rejection method, but not always in “constant time” side channel protected flow. A recently suggested constant time algorithm for this problem, uses Network Sorting and turns out to be quite efficient. This paper proposes a new method for this computation, with a side channel protected implementation. We compare it to the other methods for different combinations of L and W values. Our method turns out to be the fastest approach for the cases where L is (relatively) short and (formula presented). For example, this range falls within the parameters of NTRU LPrime, where our method achieves a 3× speedup in the string generation. This leads to an overall 1.14× speedup for the NTRU LPrime key generation.

Original languageEnglish
Title of host publicationCyber Security Cryptography and Machine Learning - 3rd International Symposium, CSCML 2019, Proceedings
EditorsShlomi Dolev, Danny Hendler, Sachin Lodha, Moti Yung
PublisherSpringer Verlag
Number of pages15
ISBN (Print)9783030209506
StatePublished - 2019
Event3rd International Symposium on Cyber Security Cryptography and Machine Learning, CSCML 2019 - Beer Sheva, Israel
Duration: 27 Jun 201928 Jun 2019

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume11527 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Conference3rd International Symposium on Cyber Security Cryptography and Machine Learning, CSCML 2019
CityBeer Sheva

Bibliographical note

Publisher Copyright:
© Springer Nature Switzerland AG 2019.


  • Coding
  • Combinatorics
  • Post Quantum Cryptography
  • Software optimization

ASJC Scopus subject areas

  • Theoretical Computer Science
  • General Computer Science


Dive into the research topics of 'Generating a random string with a fixed weight'. Together they form a unique fingerprint.

Cite this