# Analysis of Vulnerabilities That Can Occur When Generating One-Time Password
## 4 Materials and Methods
### OTP Mechanism
#### 4.1.3 Extraction Algorithm  
This is an algorithm for extracting 3-byte data from the cipher string for use as OTP. This can be divided into static and dynamic algorithms (RFC4226 [23], an OTP-related standard, specifies only dynamic algorithms, and the Telecommunication Technology Association (TTA)'s standard [21] specifies static, dynamic, and improved dynamic algorithms.). This algorithm uses 'extraction information' to specify the location to extract. It also uses the value as the 'extraction data' at the location specified by the extraction information. The extraction information may use a value of a specific area of the cipher text or a predefined value. Then, the extracted 3-byte hexadecimal value is encoded in decimal so that humans can recognize it. At this time, the extracted 3-byte range is [0, 16777215] (i.e., [0, 2\({}^{24}-1\)]), but the top two digits have little change. Therefore, the two digits are discarded and only the lower six digits are used (Only 0 \(\sim\) 1 for 10\({}^{7}\), only 0 \(\sim\) 6 for 10\({}^{6}\)); so the final range is [0, 999999]. This process corresponds to the yellow part of Figure 1.  
The static algorithm extracts data by specifying in advance the extraction information (the offset of the cipher text) to be used [21].  
An example is shown in Figure 2: Data is extracted by specifying the extraction information as the first starting point of the cipher text. It extracts 3-byte contiguous data from the extraction information. If the result of the extracted data is 0x1A2B3C, the number is 1,715,004 when expressed as a decimal number, and the final output OTP is derived as 715,004 corresponding to the lower 6 digits of the decimal number.  
The dynamic algorithm extracts data by obtaining extraction information from the cipher text [21; 23].  
About this example is shown in Figure 3: The value of the lower 4-bit of the lowest byte (i.e., 19 th) in the cipher text is used as extraction information. The extracted data is contiguous 3-byte with an index of the extraction information as a starting point. If the result of the extracted data is 0 xE7F809, that's decimal is 15,202,313, the final output OTP is derived as 202,313 corresponding to the lower 6 digits.  
Figure 2: Static extraction.  
The improved dynamic algorithm is used when generating OTP using a chip used as a smart card or USIM [21]. Figure 4 shows an improved dynamic algorithm; it extracts three bytes from two or more pieces of extraction information in the cipher text.  
Extraction information of this algorithm is used to designate specific area of cipher text. If the value of the lower 4-bit of the lowest byte is used as the first extraction information (namely, LSB 4-bit 0x0D, the lowest byte 0x4D of the cipher text), then the data 0 xE7 at that location (0x0D) is used as the first extraction data. And the second extraction information is 0x07, the value of the lower 4-bit of the first extraction data. The same method is repeated to select 3-byte extracted data. Final OTP is 171,883 which is the lower 6 digits of 15,171,883 that converts the extracted data 0 xE7812B to decimal.