0
$\begingroup$

As per specifications document,

"We have the natural restriction that at least two characters must be ciphered, i.e. $b \geq 2$"

where each character is represented by an integer of certain cardinality. So basically a $2$ integer array is the minimum.

However say I want to encrypt a single input integer but restrict it to a certain range. For example say the cardinality of the integer was $2000$ (so the range of possible values from $0 - 1999$).

Can this be done using BPS? (i.e. Would it be acceptable to simply input an integer array of size one to the algorithm with the cardinality as the range I want?)

I am trying to encrypt a year, but in a way that does not result in a year greater than current year.

$\endgroup$
1
$\begingroup$

This can't be done in a straightforward way with just BPS, since the straightforward way will result in a year greater than the current one for roughly 80% of ciphertexts (since 9999 is the biggest four-digit ciphertext possible). However, using what's called a "rank-then-encipher" scheme, you can specify an input and output format using a regex, then build an FPE scheme on just the strings matching that regex. See this site for details.

EDIT: Also, I don't know BPS that well but I think the "integer of a certain cardinality" can just be a base-10 digit, so you can encrypt a four-digit year as four characters.

|improve this answer|||||
$\endgroup$
  • $\begingroup$ I'm not clear on how the regex part works, (i.e. the conversion from one format to another). I haven't found an example illustrating the process, but I'll examine the source code for LibFTE in the meantime. $\endgroup$ – erotavlas Jan 25 '16 at 16:32
  • 1
    $\begingroup$ You'd specify a regex for a four-digit year not greater than the current year, then pass that as a parameter to the FPE scheme. Internally, it compiles the regex to a state machine, then uses the description of that state machine to create a "ranking table" used during encryption and decryption. $\endgroup$ – pg1989 Jan 25 '16 at 19:10
  • $\begingroup$ After reading further I found something called DFA or Deterministic Finite Automata. Is each state in the DFA table ranked? If so doesn't that still give you a single integer to encrypt (over a finite range of states)? I'm just not clear what the numeric input value is to the FPE - in this case of BPS what the integer array consists of. Do I need to convert the integer - I was thinking positional notation and base conversion to get a series of numbers. Oh wait maybe I could just convert to binary and encode that? $\endgroup$ – erotavlas Jan 27 '16 at 5:28
  • $\begingroup$ Your input to the algorithm is a string of "characters" in some alphabet. That alphabet could be binary, in which case your characters will be zeroes and ones. That alphabet could also be base-10, in which case your characters will be decimal digits. $\endgroup$ – pg1989 Jan 27 '16 at 19:36
  • $\begingroup$ I get that, but I need more than one character for the encryption to work. Say I use a ranking scheme to enumerate all dates between range 1901 - 2001 so 100 items, that yields one character in my 'alphabet' I'm not encrypting sequences of multiple dates side by side, only one. I don't see how enumerating states in a DFA gets around this. Otherwise i need to find a new FPE that works on single integers, but there must be a way to at least modify this one to work in my case. $\endgroup$ – erotavlas Jan 27 '16 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.