Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/351590413

A Method of Efficient OTP Generation Using Pseudorandom Number


Generators

Article · May 2021

CITATIONS READS

0 968

6 authors, including:

Zarif Khudoykulov Jamila Arzieva


Tashkent University of Information Technology Karakalpak State University
8 PUBLICATIONS   30 CITATIONS    6 PUBLICATIONS   11 CITATIONS   

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Jamila Arzieva on 14 May 2021.

The user has requested enhancement of the downloaded file.


A Method of Efficient OTP Generation Using
Pseudorandom Number Generators

Karimov Madjit Malikovich Khudoykulov Zarif Turakulovich Arzieva Jamila Tileubayevna


The State Testing Center at Cabinet Department of Cryptology Department of Applied Mathematics
of Ministers of the Republic of Tashkent University of Information Karakalpak State University
Uzbekistan Technologies Uzbekistan
Tashkent, Uzbekistan Tashkent, Uzbekistan jamka-1980@mail.ru
m.karimov@tdtu.uz zarif.xudoyqulov@mail.ru

Abstract — Something you know based authentication method One-time password or OTP is a password that is applicable
is the most classical authentication technique on the computer for only one login session or transaction, on a computer system
system, and is performed more easily and successfully than other or different digital device. OTPs ignore various shortcomings
methods even it is a vulnerable method against attacks such as that are linked with traditional, i.e., static password-based
eavesdropping or replay attack. To solve this problem, OTP (One- authentication; a number of accomplishments also integrates
time Password) technique is used. OTP is delivered from one side two-factor authentication by making sure that one-time
to the other in two approaches. In the first approach, OTP is password needs access to something a person has plus
generated on server side and sent to clients, for example, by SMS. something a person already knows.
In the second approach, OTP is generated on both sides at one time
based on shared counter, such as, HOTP. In most cases, one-way Therefore, generation of OTPs is crucial stages in two-factor
hash functions are used in both approaches to generate OTP. As authentication. In general, OTPs are delivered to parties in two
resent researches show the weakness of the hash functions, we need ways. In the former, OTP is generated on one side and sent to
new a new OTP generation algorithms to solve this problem. In other sides using SMS, email, etc. In the latter, both sides
this paper, we propose a method of creating one time password generate OTP at one time using a shared counter. The former
based on pseudorandom number generators (PRNG), which they delivery way is commonly used than the latter, such as, in
are exist on many systems and programming languages as native. financial sector.
Keywords — OTP, PRNG, HOTP, password, dynamic In this paper, we propose a method of creating one-time
truncation. passwords using random bytes generated by any secure PRNG.
Proposed method gives opportunities of generating numeric
I. INTRODUCTION OTP, upper alphanumeric OTP and lower-upper alphanumeric
Using of public channels for data transmission creates OTP depend on length requirement. In testing process, we have
potential opportunities for attackers. Therefore, one of the tasks got high level no repetition than HOTP.
of ensuring information security associated with the user is using
of methods and means to ensure the parties to each other. To This paper is organized as follows. We analyze current OTP
solve such problems, special methods are used to verify the techniques in Section 2. In section 3, we describe a new
authenticity of the parties. Authentication plays significant role algorithm. In addition, we perform simple testing of the
to solve these problems. algorithm in Section 4. In section 5, we conclude with some
remarks.
Authentication is the process of recognizing a user’s,
device’s or process’s identity. In this process, information of a II. RELATED WORKS
certain type is transmitted between the user and the system, OTP is a password system that passwords can only be used
which consists of the user ID and not all known private
once. In other words, a user has to be authenticated with a new
information (for example, password or certificate) [1].
password each time. OTP has much stronger than static
Passwords are the most often used form of authentication password because of the user enters a new password even if his
today, but this is primarily because passwords are cheap, and password is exposed. There are many solutions to create OTP
definitely not because they are the most secure option. While and we can divide them as follows:
effective and in some ways, fundamentally a part of online
security, password authentication protocols fail when you don't Challenge-Response based OTP. In this method, function F
address them seriously. This means constructing complex is used to generate OTP: 𝑂𝑇𝑃 𝐹 𝑅 , 𝐾 . There, 𝑅 –
passwords and maintaining secrecy. This also means that entities challenge for session 𝑖 and 𝐾 – key that known to only both
implementing password authentication must safeguard sides. Based on 𝑅 , function 𝐹 generates new OTP. HOTP and
passwords in some way. TOTP are two famous example in this type. For example, in
HOTP algorithm, counter is used as challenge [2]. Current time
in millisecond is used instead of counter in TOTP [3]. Besides
that, hash functions are used as function F in many cases, such 5. 𝐹 𝑅, 𝐶 – OTP generation method and for this
as SHA-1 is used in HOTP and TOTP. This type of OTP is equation of 𝑃 𝐹 𝑅, 𝐶 𝐹 𝐿, 𝑆 , 𝐶 is true.
generated in both sides or one side. In the former, one side send
OTP to other and both OTPs are compared in second side and Proposed method can generate OTP consist of 𝑆 , 𝑆 𝑎𝑛𝑑 𝑆
first side is authenticated based on result [2, 3]. In the latter, the character sets. Therefore, we show the each case detailed depend
challenge is sent from one side to other and the response is sent on character sets.
reverse style [6, 7, 8]. Algorithm 1. Generation of OTP consist of 𝑆 character set
PRNG based OTP. In this method, random bytes are taken Numeric OTP are most used in OTP based authentication,
from any PRNG and presented as OTP by transformation such as, HOTP, TOTP. In algorithm 1, function of generating
function 𝐹. In practice, system PRNG, like, /dev/random or numeric OTP described as follow: 𝐹 𝑅, 𝐶 𝐹 𝐿, 𝑆 , 𝐶
/dev/urandom, CryptGen Random can be used and they are not and for any required length of OTP, 32-byte random sequences,
required additional secret data to generate random bytes. There 𝐶 are generated from PRNG. After that, following sequences
are many PRNG based OTPs [4, 5, 9, 10]. However, in all these are performed:
PRNG based OTP generators, special hardware is used to
generate random bytes but it requires extra cost to implement. 1. Last and first four bit of 𝐶 are extracted and
accumulated on decimal system. We notate this
III. PROPOSED WORKS accumulation as index, I.
In this section, we describe proposed OTP algorithm based 2. From the I bit of 𝐶 , we extract 8 byte of random
on PRNG. General view of the proposed methods is illustrated sequence and notate this as 𝐺 . If there will not be
in Fig. 1. New random OTP are generated given requirements enough bytes from index, I of 𝐶 , rest of 𝐺 are
and inputted random bytes from PRNG. You can use any secure extracted from beginning of 𝐶 .
PRNG that is exist on your operation system or programming 3. Extracted 𝐺 are described on decimal system and
languages, such as, CryptGen Random function on Windows notated as 𝑁 . Required 𝑃 are calculated using this
OS, /dev/urandom on Linux OS or Java Random(), Python equation, 𝑃 𝑁 𝑚𝑜𝑑10 . There, 𝐿 ∈ 6, 10 – required
Random() classes. OTP’s length.
We firstly generate 32 bytes from PRNG and extract 8 byte
from it depend on index, I. This process are called as dynamic
truncation and serves to eliminate repeatability of OTP.
Algorithm 2. Generation of OTP consist of 𝑆 character set
In algorithm 2, function of generating numeric OTP
described as follow: 𝐹 𝑅, 𝐶 𝐹 𝐿, 𝑆 , 𝐶 and for any
Fig 1. General view of proposed OTP method based on PRNG required length of OTP, 32-byte random sequences, 𝐶 are
We define requirements for generated OTP as follow: generated from PRNG. After that, following sequences are
performed:
1. Length of OTP. Required length of OTP must be on
between 6 and 10. This is standard requirement for the 1. Last and first four bit of 𝐶 are extracted and
length of OTP [2, 3]. accumulated on decimal system. We notate this
2. Character type. Generated OTP may consist numeric, accumulation as index, I.
upper alphanumeric and lower-upper alphanumeric 2. From the I bit of 𝐶 , we extract n bit of random
characters: 0, … ,9 , 0, … ,9, 𝐴, … , 𝑍 and sequence and notate this as 𝐺 . If there will not be
0, … ,9, 𝑎, … , 𝑧, 𝐴, … , 𝑍 . Special characters (for enough bytes from index, I of 𝐶 , then rest of 𝐺 are
example, @,?,!) are not suitable for OTP because of time extracted from beginning of 𝐶 . Values of n depend on
is limited to input or process may be unpleasant for users. required length of OTP and this dependency is given as
The notations used in describing the methods are presented follow:
as follow: 𝑳 𝒏 (bit)
1. 𝑆 0, … ,9 , 𝑆 0, … ,9, 𝐴, … , 𝑍 , 𝑆 6 31
0, … ,9, 𝑎, … , 𝑧, 𝐴, … , 𝑍 –character set. Lengths of each 7 36
character set are: 𝑙𝑒𝑛 𝑆 10, 𝑙𝑒𝑛 𝑆 8 40
36, 𝑙𝑒𝑛 𝑆 62. 9 46
2. 𝑅 𝐿, 𝑆 – requirement for OTP, 𝐿 – length of OTP 10 50
(𝐿 ∈ 6, 10 ) and 𝑆 – set of characters for (𝑖 ∈ 0,2 ). 3. Extracted 𝐺 are described on decimal system and
3. 𝐶 – generated 𝑖 random bytes and 𝑙 is length of it on notated as 𝑁 . To calculate 𝑃 , we use
bytes. 𝑏𝑎𝑠𝑒36𝑒𝑛𝑐𝑜𝑑𝑒 𝑁 function which described as
4. 𝑃 – generated 𝑖 OTP. follow:
def base36encode(integer): return sign + result
chars = To choose most suitable n, there is also used the assumption
'0123456789ABCDEFGHIJKLMNOPQRSTUVW that used in Algorithm 2.
XYZ'
sign = '-' if integer < 0 else '' IV. PERFORMANCE ANALYSIS
integer = abs(integer) We have performed a testing process our method of OTP
result = '' generation to confirm effectiveness. Testing process can be
while integer > 0: divided into three stages:
integer, remainder =
divmod(integer, 36) 1. We have implemented HOTP algorithms to generate 1
result = chars[remainder] + result million six digit OTP.
return sign + result 2. We got directly 8 byte from PRNG, converted it to
decimal system and divided it to 106 to generate 6 digit
To choose suitable n, try to get maximum dividend as much OTP. This process is performed to get 1 million OTP.
as possible in case of given OTP length, 𝐿. Because, only in this 3. We have implemented Algorithm 1 to generate 1 million
case, generated OTP’ length are equal to 𝐿 with high six digit OTP.
probability. In other case, generated OTP prefixed with zero
until required length of OTP, 𝐿. We implemented testing process at one million times, for
six digit OTP because of ideal OTP generator is not generate
Algorithm 3. Generation of OTP consist of 𝑆 character set same OTP in this case. Overall results are presented in Table 1.
In algorithm 3, function of generating numeric OTP
TABLE I. TESTING RESULTS FOR S0 CHARACTER SETS USING DIFFERENT
described as follow: 𝐹 𝑅, 𝐶 𝐹 𝐿, 𝑆 , 𝐶 and for any PRNG
required length of OTP, 32-byte random sequences, 𝐶 are Number of occurrences

(OTP length)

No repetition
generated from PRNG. After that, following sequences are generators

More than
performed:
ОТР

2 times

3 times

4 times

5 times

6 times

7 times

8 times

9 times

Total
1. Last and first four bit of 𝐶 are extracted and
accumulated on decimal system. We notate this Results of HOTP implementation – stage 1
accumulation as index, I. 61 15 5 367
HOTP 183 30 7 264
2. From the I bit of 𝐶 , we extract n bit of random (6) 835
44 38
56
0
2
7 2 0
304
567
3 4 5
sequence and notate this as 𝐺 . If there will not be Based on directly got bytes from PRNG without dynamic truncation –
enough bytes from index, I of 𝐶 , then rest of 𝐺 are stage 2
extracted from beginning of 𝐶 . Values of n depend on Java
61 15 5
required length of OTP and this dependency is given as Rando 184 30 7 1 264 367
11 33 5 0 0
m() 123 79 7 0 290 735
follow: (6)
7 0 4
𝑳 𝒏 (bit) Python 61 15 4
184 30 5 264 367
6 34 Rando 09 45 9 7 0 0
407 68 8 587 291
m() (6) 9 1 7
7 40 CryptG
61 15 4
8 46 en 184
28 25
30
5
7
6 1 0
264 367
Rando 675 72 0 829 083
9 52 8 8 9
m (6)
10 58 /dev/ur 61 15 5
184 29 6 264 367
andom 33 24 1 9 0 0
687 04 9 759 481
(6) 0 5 5
3. Extracted 𝐺 are described on decimal system and Results of Algorithm 1 implementation – stage 3
notated as 𝑁 . To calculate 𝑃 , we use CryptG
61 15 5
𝑏𝑎𝑠𝑒62𝑒𝑛𝑐𝑜𝑑𝑒 𝑁 function which described as follow: en 183
55 20
30
5
7
7 0 0
264 367
def base62encode(integer): Rando 620 65 9 090 982
4 9 6
chars = m (6)
Java
'0123456789ABCDEFGHIJKLMNOPQRSTUVW 61 15 5
Rando 184 31 6 264 368
XYZabcdefghijklmnopqrstuvwxyz' 00 29 1 8 1 0
m() 089 74 8 147 152
7 0 0
sign = '-' if integer < 0 else '' (6)
integer = abs(integer) Python 61 15 5
184 31 8 264 367
Rando 18 35 1 6 0 1
result = '' 082 07 3 334 590
m() (6) 1 8 6
while integer > 0: dev/ura 61 15 5
integer, remainder = 184 30 6 1 264 367
ndom 23 28 2 1 0
148 94 6 2 358 703
divmod(integer, 62) (6) 4 3 0
result = chars[remainder] +
result
In table 1, repetition state begins from two for 1 million OTP [4] Y. Lee, H. Lim and H. Lee, "A study on efficient OTP generation using
stream cipher with random digit", in 2010 The 12th International
generated by the generators and also no repetition number of Conference on Advanced Communication Technology (ICACT), Phoenix
OTP among 1 million is given. The results show that directly Park, 2010, pp. 1670-1675.
using random bytes from PRNG to generate OTP is not [5] M. D. Leonhard and V. N. Venkatakrishnan, "A comparative study of
applicable. In general, it has been proven that the proposed OTP three random password generators," 2007 IEEE International Conference
generation method generates OTP with high levels of no on Electro/Information Technology, Chicago, IL, 2007, pp. 227-232.
repetition for all PRNG. Besides that, received confirmation is [6] H. Raddum, L. Hopland Nestas and K. Jørgen Hole, "Security Analysis
of Mobile Phones Used as OTP Generators", in In IFIP International
also valid for the other OTP lengths. Workshop on Information Security Theory and Practices, Berlin,
Heidelberg, 2010, pp. 324-331.
V. CONCLUSION [7] M. Alzomai and A. Josang, "The Mobile Phone as a Multi OTP Device
We introduced a general OTP generation method based Using Trusted Computing," 2010 Fourth International Conference on
Network and System Security, Melbourne, VIC, 2010, pp. 75-82.
PRNG, and proved that it has a higher degree of no-repetition
[8] S. Lee, J. Lee, M. Lee, S. Lee, D. Choi and D. Kim, "Low-Power Design
than HOTP. Besides that, we presented dynamic truncation of Hardware One-Time Password Generators for Card-Type OTPs", ETRI
function to eliminate repetition degree of random bytes Journal, vol. 33, no. 4, pp. 611-620, 2011.
generated from PRNG and it is effective way to generate high [9] F. Y. Tao and S. G. Ping, "Design of Two-Way One-Time-Password
degree random OTPs. Authentication Scheme Based on True Random Numbers," 2009 Second
International Workshop on Computer Science and Engineering, Qingdao,
REFERENCES 2009, pp. 11-14.
[1] M. Stamp, Information security, 2nd ed. Hoboken, NJ: Wiley, 2011. [10] K. Alghathbar and H. A. Mahmoud, "Noisy password scheme: A new
one time password system," 2009 Canadian Conference on Electrical and
[2] D. M’Raihi, S. Machani, M.Pei, & J. Rydell, "Totp: Time-based one-time Computer Engineering, St. John's, NL, 2009, pp. 841-846.
password algorithm." Internet Request for Comments, 2011.
[3] D. M’Raihi, M. Bellare, F. Hoornaert, D.Naccache, & O. Ranen, "Hotp:
An hmac-based one-time password algorithm." The Internet Society,
Network Working Group, RFC4226, 2005.

View publication stats

You might also like