Quellcode durchsuchen

updating primeset and mishmash_test.go

master
William Dillon vor 3 Jahren
Ursprung
Commit
262ea789d3
2 geänderte Dateien mit 36 neuen und 35 gelöschten Zeilen
  1. 32
    31
      mishmash.go
  2. 4
    4
      mishmash_test.go

+ 32
- 31
mishmash.go Datei anzeigen

@@ -1,37 +1,38 @@
package mishmash

var PrimeSet = [256]uint32{
3238836313, 3360886099, 3993634273, 4064669561, 4208856901, 4049234129, 2251082663, 2536872017,
3172087459, 4219386191, 3254853737, 2374917353, 3448754471, 3118274443, 3572204863, 3686337631,
2961431969, 3025133497, 2856326813, 4277854241, 2469276751, 3175023217, 4065345943, 2191667573,
3716607571, 3186473551, 2993231543, 2854210481, 3661300009, 4160057677, 3393580357, 2401731751,
3089619301, 3049406923, 2689305253, 2226455687, 2384594237, 2321314543, 3358155473, 2769745513,
4064412181, 3546679369, 2971824769, 3312622147, 3878690237, 4226789561, 3945135893, 2667481697,
3886727213, 2447929819, 2905769257, 2655507487, 2151468307, 2774610127, 3117477541, 2619506011,
2224830217, 4005223571, 2817826603, 4024485649, 2357623691, 3380603881, 3799676627, 3174723401,
2925703279, 3692030071, 3928564727, 3822903739, 2520472573, 2345602981, 2318506963, 2933432651,
2964809711, 3441413681, 3537168083, 3213751901, 3785291413, 3874794739, 2703288127, 4139044993,
2757352427, 3533741287, 2767266521, 3616593653, 4121176723, 2759804627, 2613878749, 3621322741,
3365797381, 3780923077, 4090912909, 2400326909, 3222524423, 2824243943, 2496802109, 2268391639,
3124087573, 3716479807, 3131673143, 2598657163, 3239086001, 3049736639, 2288116447, 3310352849,
3095504927, 3299510729, 4177820137, 3414229717, 3243438811, 3532678967, 3232117841, 3951863177,
2555079403, 3921722923, 2767778263, 3642539597, 2259834439, 3378013361, 3318867061, 2219022677,
4283411207, 3528301687, 2626036943, 2258523251, 3833937103, 3639081947, 4029829451, 2360238479,
2184594703, 4187931989, 2562197887, 3622455827, 3374449921, 3194095649, 4048368617, 2355855647,
4187863969, 3671153483, 2548899877, 3752659289, 3019207333, 3000748913, 2969725901, 2288226749,
3941344529, 2160836201, 2557613741, 2747755807, 2813873353, 2437638083, 2278088377, 2925209927,
4245758497, 3470038853, 2625083243, 2293827821, 3819793067, 3887526641, 3810382399, 4129510223,
3184769573, 3942422921, 3000411851, 2267160979, 3295636387, 3962735783, 2857209623, 2388617971,
3691266013, 2683345051, 3245511107, 3349852217, 2544095017, 3631826647, 4105881239, 2762987873,
2666463031, 2946438881, 3113899517, 2223454549, 2568559537, 3101729287, 2555320727, 3030152533,
2979132743, 4253672737, 2870043779, 2843306603, 3926687683, 4185601351, 3731200831, 3722500409,
4115072947, 2615487569, 2389531631, 3868949611, 2337008593, 2515079899, 2521605199, 3168567119,
3580694591, 3845527589, 3722753051, 2668632049, 3667111729, 3874685057, 3226838213, 2720181421,
2612026369, 2694744433, 4155238081, 3521473309, 3862885931, 3115061903, 4166213797, 3520042793,
3944208013, 4078403383, 2285388311, 3719800027, 4016404867, 3390427661, 3338388139, 2660266009,
3032933947, 4200211513, 3155686909, 3019786009, 4125535433, 3244923947, 2398660417, 2758948859,
2944556507, 3818410403, 2247818519, 2586876613, 3420280733, 4236637451, 2724168703, 3321056041,
2625015193, 2795623993, 3911522341, 3507684083, 3553065317, 3987511039, 2786582429, 2534596151,
3825240899, 3652005211, 2966014067, 3432177659, 3109134187, 3139884271, 3108258589, 2277840529,
3748140223, 4206444373, 2684505017, 3883989821, 4076539213, 3880335997, 2603229667, 2358458953,
4061135443, 3826856503, 2671898833, 3266747401, 3403611587, 2483486933, 3889003891, 2820911959,
2318077829, 3470930861, 3231587809, 3225029887, 4123396483, 3422817119, 3612514831, 2170177423,
3058754837, 3000926393, 2825656217, 3387930461, 3532314017, 3245479361, 3466327211, 4080294503,
4252034179, 2302986211, 3394476707, 3697851029, 3957195257, 2862308587, 4285266071, 3681357247,
3157577413, 3839398561, 3097979117, 3590787463, 3354450497, 3110291879, 3938796493, 3196834463,
2374254481, 2702597567, 3046228397, 3461690719, 2641445467, 2401060583, 2483505539, 2775297373,
2262447391, 3118976533, 3014355683, 3355176449, 4055753381, 2277045713, 3098402119, 3894957487,
2770620887, 4125228329, 2575044467, 4162428989, 3294651817, 2308925797, 3698223103, 2150023273,
3075614681, 2410764047, 3624889381, 3264455489, 3241969651, 3001767217, 3407799859, 2998917373,
2629826653, 2714272271, 3987786247, 2880807353, 3608804803, 2231694917, 3790372403, 4156893413,
2563320007, 2423350621, 2735169119, 4021079791, 4150641413, 2907916357, 3772971647, 2481168307,
2842943119, 2234753693, 3966637117, 2732029457, 3207475039, 3533605151, 2349367747, 3336108011,
2431060103, 2263416899, 2350941683, 3869512277, 3880987697, 3062735029, 2512894603, 3669845519,
2235487739, 3201016501, 2438124943, 4170458909, 2938134889, 4231610087, 3187120061, 2378420137,
3365835877, 3078766697, 3704906059, 3541986781, 3969072823, 3510542281, 2306290751, 3898737419,
2898069347, 4092904481, 2484285403, 2721169823, 4293617527, 2928584759, 2213966141, 2335957513,
3367371923, 2965261109, 4175805451, 3541995157, 2964065479, 3997902791, 3053542259, 2168926237,
3253268639, 2620083509, 3314283407, 3873087809, 2636771209, 2737638653, 3209154931, 3414204793,
3451689091, 2638985941, 2899591693, 2654878441, 2748067627, 3395485733, 2679070523, 3100687721,
2520033701, 2980087373, 2873947007, 2565436501, 2400053783, 4163039563, 3517993571, 4263192407,
3385597069, 2768101117, 3502890653, 3092130347, 3748553827, 4109944849, 2418961109, 3398621741,
3073383031, 2167592489, 2950739053, 3529429811, 3167420899, 4254703357, 3344014309, 3725480141,
3745944539, 3456003191, 2832137237, 4202217191, 3730577581, 2837794231, 2155546451, 2539211039,
2256984649, 2458975411, 2986340839, 3412432363, 3596817463, 2973444983, 2409734297, 3273292601,
3302556869, 3630727567, 3670056499, 3300959521, 3949319809, 3047032057, 3412226563, 2147483647,
2914045411, 2882644273, 4065606553, 2735903059, 3195020617, 3887229457, 3232900987, 3409357867,
3037985513, 3162012463, 3340137193, 2186608547, 4018093523, 4153387103, 2566863161, 3087918809,
3332247019, 3579407009, 3082973791, 4178339461, 3269728331, 2270495261, 2400046513, 2641204147,
2593078337, 2398468271, 3861488311, 3766456459, 2970457213, 3491800771, 3797865553, 2756555203,
3154883449, 3782386073, 3324965471, 4088422453, 3784508591, 3903657481, 3010059277, 2936392909,
}

func selectPrime(n uint64) uint64 {

+ 4
- 4
mishmash_test.go Datei anzeigen

@@ -6,7 +6,7 @@ import (
)

func TestMishmash(t *testing.T) {
want := "59dadb24"
want := "1b309ba0"
if got := fmt.Sprintf("%08x", Mishmash("google.com")); want != got {
t.Error("TestMishmash() = got", got, "want", want)
} else {
@@ -15,7 +15,7 @@ func TestMishmash(t *testing.T) {
}

func TestSecondHash(t *testing.T) {
want := "5ba2a3f1"
want := "1ce66335"
if got := fmt.Sprintf("%08x", Mishmash("google.com", uint64(Mishmash("google.com")))); want != got {
t.Error("TestSecondHash() = got", got, "want", want)
} else {
@@ -24,7 +24,7 @@ func TestSecondHash(t *testing.T) {
}

func TestSeedOne(t *testing.T) {
want := "eb734861"
want := "5839f5f3"
if got := fmt.Sprintf("%08x", Mishmash("google.com", uint64(1))); want != got {
t.Error("TestSeedOne() = got", got, "want", want)
} else {
@@ -33,7 +33,7 @@ func TestSeedOne(t *testing.T) {
}

func TestEngineAndAccumulator(t *testing.T) {
want := "a189111f"
want := "a3bbaee4"
test := "google.com"
accum := Engine(test, len(test), 0)
if got := fmt.Sprintf("%08x", Mishmash(test, accum)); want != got {

Laden…
Abbrechen
Speichern