diff --git a/README.md b/README.md index 53b1b3a..94fd19a 100644 --- a/README.md +++ b/README.md @@ -74,23 +74,23 @@ func main() { 各算法检测参数如下: -序号 | 检测项目 | 参数 | ---- | --- | --- | -1 | 单比特频数检测 | - | -2 | 块内频数检测 | m = 100 | -3 | 扑克检测 | m = 8 | -4 | 重叠子序列检测 | m = 5 | -5 | 游程总数检测 | - | -6 | 游程分布检测 | - | -7 | 块内最大游程检测 | m = 10000 | -8 | 二元推导检测 | k = 7 | -9 | 自相关检测 | d = 16 | -10 | 矩阵秩检测 | M = 32, Q= 32 | -11 | 累加和检测 | - | -12 | 近似熵检测 | m = 5 | -13 | 线型复杂度检测 | m = 500 | -14 | Maurer通用统计检测 | - | -15 | 离散傅里叶检测 | - | +序号 | 检测项目 | 参数 | +--- | --- |--------------| +1 | 单比特频数检测 | - | +2 | 块内频数检测 | m = 10000 | +3 | 扑克检测 | m = 4,8 | +4 | 重叠子序列检测 | m = 3,5 | +5 | 游程总数检测 | - | +6 | 游程分布检测 | - | +7 | 块内最大游程检测 | m = 10000 | +8 | 二元推导检测 | k = 3,7 | +9 | 自相关检测 | d = 1,2,8,16 | +10 | 矩阵秩检测 | - | +11 | 累加和检测 | - | +12 | 近似熵检测 | m = 2,5 | +13 | 线型复杂度检测 | m = 500,1000 | +14 | Maurer通用统计检测 | L=7,Q=1280 | +15 | 离散傅里叶检测 | - | ## 工具 diff --git a/overlapping.go b/overlapping.go index 9e366ce..2849b0f 100644 --- a/overlapping.go +++ b/overlapping.go @@ -28,8 +28,9 @@ func OverlappingTemplateMatching(data []byte) *TestResult { // OverlappingTemplateMatchingTest 重叠子序列检测方法,m=5 // bits: 检测序列 // return: -// p1: P-value1 -// p2: P-value2 +// +// p1: P-value1 +// p2: P-value2 func OverlappingTemplateMatchingTest(bits []bool) (p1 float64, p2 float64, q1 float64, q2 float64) { return OverlappingTemplateMatchingProto(bits, 5) } @@ -38,18 +39,20 @@ func OverlappingTemplateMatchingTest(bits []bool) (p1 float64, p2 float64, q1 fl // data: 检测序列 // m: m长度,m=2,5 // return: -// p1: P-value1 -// p2: P-value2 +// +// p1: P-value1 +// p2: P-value2 func OverlappingTemplateMatchingTestBytes(data []byte, m int) (p1 float64, p2 float64, q1 float64, q2 float64) { return OverlappingTemplateMatchingProto(B2bitArr(data), m) } // OverlappingTemplateMatchingProto 重叠子序列检测方法 // bits: 检测序列 -// m: m长度,m=2,5 +// m: m长度,m=3,5 // return: -// p1: P-value1 -// p2: P-value2 +// +// p1: P-value1 +// p2: P-value2 func OverlappingTemplateMatchingProto(bits []bool, m int) (p1 float64, p2 float64, q1 float64, q2 float64) { n := len(bits) if n < 5 { diff --git a/tools/rddetector/README.md b/tools/rddetector/README.md index 41e882b..6d5b765 100644 --- a/tools/rddetector/README.md +++ b/tools/rddetector/README.md @@ -32,23 +32,22 @@ rddetector -i 待检测数据目录 [-o 生成报告位置] ``` -15中检测方法的监测参数如下: - -序号 | 检测项目 | 参数 | - --- | --- | --- | -1 | 单比特频数检测 | - | -2 | 块内频数检测 | m = 100 | -3 | 扑克检测 | m = 8 | -4 | 重叠子序列检测 | m = 5 | -5 | 游程总数检测 | - | -6 | 游程分布检测 | - | -7 | 块内最大游程检测 | m = 10000 | -8 | 二元推导检测 | k = 7 | -9 | 自相关检测 | d = 16 | -10 | 矩阵秩检测 | M = 32, Q= 32 | -11 | 累加和检测 | - | -12 | 近似熵检测 | m = 5 | -13 | 线型复杂度检测 | m = 500 | -14 | 通用统计检测 | - | -15 | 离散傅里叶检测 | - | - +15种检测方法的检测参数如下: + +序号 | 检测项目 | 参数 | +--- | --- |--------------| +1 | 单比特频数检测 | - | +2 | 块内频数检测 | m = 10000 | +3 | 扑克检测 | m = 4,8 | +4 | 重叠子序列检测 | m = 3,5 | +5 | 游程总数检测 | - | +6 | 游程分布检测 | - | +7 | 块内最大游程检测 | m = 10000 | +8 | 二元推导检测 | k = 3,7 | +9 | 自相关检测 | d = 1,2,8,16 | +10 | 矩阵秩检测 | - | +11 | 累加和检测 | - | +12 | 近似熵检测 | m = 2,5 | +13 | 线型复杂度检测 | m = 500,1000 | +14 | Maurer通用统计检测 | L=7,Q=1280 | +15 | 离散傅里叶检测 | - | diff --git a/tools/rddetector/main.go b/tools/rddetector/main.go index f8b69da..4b18555 100644 --- a/tools/rddetector/main.go +++ b/tools/rddetector/main.go @@ -37,7 +37,7 @@ func worker(jobs <-chan string, out chan<- *R) { p, _ = randomness.PokerProto(bits, 8) arr = append(arr, p) - p1, p2, _, _ := randomness.OverlappingTemplateMatchingProto(bits, 2) + p1, p2, _, _ := randomness.OverlappingTemplateMatchingProto(bits, 3) arr = append(arr, p1, p2) p1, p2, _, _ = randomness.OverlappingTemplateMatchingProto(bits, 5) arr = append(arr, p1, p2) @@ -71,7 +71,9 @@ func worker(jobs <-chan string, out chan<- *R) { arr = append(arr, p) p, _ = randomness.ApproximateEntropyProto(bits, 5) arr = append(arr, p) - p, _ = randomness.LinearComplexityTest(bits) + p, _ = randomness.LinearComplexityProto(bits, 500) + arr = append(arr, p) + p, _ = randomness.LinearComplexityProto(bits, 1000) arr = append(arr, p) p, _ = randomness.MaurerUniversalTest(bits) arr = append(arr, p) @@ -144,26 +146,27 @@ func main() { _, _ = w.WriteString( "源数据," + "单比特频数检测," + - "块内频数检测," + - "扑克检测m=4," + - "扑克检测m=8," + - "重叠子序列检测m=2 P1,重叠子序列检测m=2 P2," + - "重叠子序列检测m=5 P1,重叠子序列检测m=5 P2," + + "块内频数检测 m=10000," + + "扑克检测 m=4," + + "扑克检测 m=8," + + "重叠子序列检测 m=3 P1,重叠子序列检测 m=2 P2," + + "重叠子序列检测 m=5 P1,重叠子序列检测 m=5 P2," + "游程总数检测," + "游程分布检测," + - "块内最大”1“游程检测," + - "二元推导检测k=3," + - "二元推导检测k=7," + - "自相关检测d=1," + - "自相关检测d=2," + - "自相关检测d=8," + - "自相关检测d=16," + + "块内最大游程检测 m=10000," + + "二元推导检测 k=3," + + "二元推导检测 k=7," + + "自相关检测 d=1," + + "自相关检测 d=2," + + "自相关检测 d=8," + + "自相关检测 d=16," + "矩阵秩检测," + "累加和检测," + - "近似熵检测m=2," + - "近似熵检测m=5," + - "线性复杂度检测," + - "Maurer通用统计检测," + + "近似熵检测 m=2," + + "近似熵检测 m=5," + + "线性复杂度检测 m=500," + + "线性复杂度检测 m=1000," + + "Maurer通用统计检测 L=7 Q=1280," + "离散傅里叶检测\n") var wg sync.WaitGroup var cnt = make([]int32, 25)