#NEWLINE# def blockmix_salsa8( BY , Yi , r ) : #NEWLINE# #INDENT# 'Blockmix; Used by SMix.' #NEWLINE# start = ( ( ( 2 * r ) - 1 ) * 16 ) #NEWLINE# X = BY [ start : ( start + 16 ) ] #NEWLINE# for i in xrange ( 0 , ( 2 * r ) ) : #NEWLINE# #INDENT# for xi in xrange ( 0 , 16 ) : #NEWLINE# #INDENT# X [ xi ] ^= BY [ ( ( i * 16 ) + xi ) ] #NEWLINE# #UNINDENT# salsa20_8 ( X ) #NEWLINE# aod = ( Yi + ( i * 16 ) ) #NEWLINE# BY [ aod : ( aod + 16 ) ] = X [ : 16 ] #NEWLINE# #UNINDENT# for i in xrange ( 0 , r ) : #NEWLINE# #INDENT# aos = ( Yi + ( i * 32 ) ) #NEWLINE# aod = ( i * 16 ) #NEWLINE# BY [ aod : ( aod + 16 ) ] = BY [ aos : ( aos + 16 ) ] #NEWLINE# #UNINDENT# for i in xrange ( 0 , r ) : #NEWLINE# #INDENT# aos = ( Yi + ( ( ( i * 2 ) + 1 ) * 16 ) ) #NEWLINE# aod = ( ( i + r ) * 16 ) #NEWLINE# BY [ aod : ( aod + 16 ) ] = BY [ aos : ( aos + 16 ) ]