#NEWLINE# def test_OATH_HOTP_values( self ) : #NEWLINE# #INDENT# ' Test OATH HOTP known results. ' #NEWLINE# test_vectors = [ ( 0 , 'cc93cf18508d94934c64b65d8ba7667fb7cde4b0' , 755224 ) , ( 1 , '75a48a19d4cbe100644e8ac1397eea747a2d33ab' , 287082 ) , ( 2 , '0bacb7fa082fef30782211938bc1c5e70416ff44' , 359152 ) , ( 3 , '66c28227d03a2d5529262ff016a1e6ef76557ece' , 969429 ) , ( 4 , 'a904c900a64b35909874b33e61c5938a8e15ed1c' , 338314 ) , ( 5 , 'a37e783d7b7233c083d4f62926c7a25f238d0316' , 254676 ) , ( 6 , 'bc9cd28561042c83f219324d3c607256c03272ae' , 287922 ) , ( 7 , 'a4fb960c0bc06e1eabb804e5b397cdc4b45596fa' , 162583 ) , ( 8 , '1b3c89f65e6c9e883012052823443f048b4332db' , 399871 ) , ( 9 , '1637409809a679dc698207310c8c7fc07290d9e5' , 520489 ) , ( 30 , '543c61f8f9aeb35f6dbc3a6847c3fe288cc0ee4c' , 26920 ) ] #NEWLINE# for ( c , expected , code ) in self : #NEWLINE# #INDENT# hmac_result = self . hsm . hmac_sha1 ( self . phantom , struct . pack ( '> Q' , c ) ) . get_hash ( ) #NEWLINE# self . assertEqual ( expected , hmac_result . encode ( 'hex' ) ) #NEWLINE# self . assertEqual ( code , pyhsm . oath_hotp . truncate ( hmac_result , length = 6 ) )