dimanche 16 février 2020

Frequency Monobit Test in Excel

  1. Open Microsoft Excel
  2. Save the Excel file as Macro Enabled file
  3. Alt+F11 to open the VBA Editor and input below function
Function AddDigits(Number As Long) As Integer

    Dim i, n As Integer
    Dim Sum As Integer
    Dim sNumber As String

    sNumber = CStr(Number)
    For i = 1 To Len(sNumber)
        n = CInt(Mid(sNumber, i, 1))
        
        If (n <= 0) Then
           n = -1
        End If
        
        Sum = Sum + n
    Next
    AddDigits = Sum
End Function
  1. Input Cell A1 for the Binary Digits); And in B1 use the function by "=AddDigits(A1)"
  2. Use the formula from this link: https://i.stack.imgur.com/6iZU8.png

Reference for the Formula: (NIST) A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications - Dr. Andrew Rukhin, et.al

Aucun commentaire:

Enregistrer un commentaire