📄 hash_usenix.ps
字号:
2638(we)X2759(\256rst)X2910(examine)X3209(bit)X3320(0)X3386(of)X3479(the)X3603(bitmap)X3851(\(the)X4002(bit)X4112(to)X2418 828(consult)N2673(when)X2871(0)X2934(bits)X3072(of)X3162(the)X3283(hash)X3453(value)X3650(are)X3772(being)X3973(exam-)X2418 916(ined\).)N2631(If)X2713(it)X2785(is)X2866(set)X2982(\(indicating)X3356(that)X3503(the)X3628(bucket)X3869(split\),)X4080(we)X2418 1004(begin)N2617(considering)X3012(the)X3131(bits)X3267(of)X3355(the)X3473(32-bit)X3684(hash)X3851(value.)X4085(As)X2418 1092(bit)N2525(n)X2587(is)X2662(revealed,)X2977(a)X3035(mask)X3226(equal)X3422(to)X3506(2)X2 f7 s1060(n)Y9 f3583(+)X1 f3614(1)X2 f10 s9 f1092(-)Y1 f3686(1)X3748(will)X3894(yield)X4076(the)X2418 1180(current)N2675(bucket)X2918(address.)X3228(Adding)X3496(2)X2 f7 s1148(n)Y9 f3573(+)X1 f3604(1)X2 f10 s9 f1180(-)Y1 f3676(1)X3744(to)X3834(the)X3960(bucket)X2418 1268(address)N2701(identi\256es)X3035(which)X3272(bit)X3397(in)X3500(the)X3639(bitmap)X3902(must)X4098(be)X2418 1356(checked.)N2743(We)X2876(continue)X3173(revealing)X3493(bits)X3628(of)X3715(the)X3833(hash)X4000(value)X2418 1444(until)N2591(all)X2698(set)X2814(bits)X2955(in)X3043(the)X3167(bitmap)X3415(are)X3540(exhausted.)X3907(The)X4058(fol-)X2418 1532(lowing)N2682(algorithm,)X3055(a)X3133(simpli\256cation)X3614(of)X3723(the)X3863(algorithm)X2418 1620(due)N2565(to)X2658(Ken)X2823(Thompson)X3196([THOM90,)X3590(TOR88],)X3908(uses)X4076(the)X2418 1708(hash)N2625(value)X2839(and)X2995(the)X3133(bitmap)X3395(to)X3497(calculate)X3823(the)X3960(bucket)X2418 1796(address)N2679(as)X2766(discussed)X3093(above.)X0(Courier)xf 0 f1 f0 f8 s2418 2095(hash)N2608(=)X2684 -0.4038(calchash\(key\);)AX2418 2183(mask)N2608(=)X2684(0;)X2418 2271(while)N2646 -0.4018(\(isbitset\(\(hash)AX3254(&)X3330(mask\))X3558(+)X3634(mask\)\))X2706 2359(mask)N2896(=)X2972(\(mask)X3200(<<)X3314(1\))X3428(+)X3504(1;)X2418 2447(bucket)N2684(=)X2760(hash)X2950(&)X3026(mask;)X2 f10 s3211 2812(sdbm)N1 f2590 2944(The)N2 f2738(sdbm)X1 f2930(library)X3167(is)X3243(a)X3302(public-domain)X3791(clone)X3987(of)X4076(the)X2 f2418 3032(ndbm)N1 f2638(library,)X2914(developed)X3286(by)X3408(Ozan)X3620(Yigit)X3826(to)X3929(provide)X2 f2418 3120(ndbm)N1 f2596('s)X2692(functionality)X3139(under)X3359(some)X3565(versions)X3869(of)X3973(UNIX)X2418 3208(that)N2559(exclude)X2830(it)X2894(for)X3008(licensing)X3317(reasons)X3578([YIG89].)X3895(The)X4040(pro-)X2418 3296(grammer)N2735(interface,)X3064(and)X3207(the)X3332(basic)X3524(structure)X3832(of)X2 f3926(sdbm)X1 f4121(is)X2418 3384(identical)N2733(to)X2 f2834(ndbm)X1 f3051(but)X3192(internal)X3476(details)X3723(of)X3828(the)X2 f3964(access)X1 f2418 3472(function,)N2726(such)X2894(as)X2982(the)X3101(calculation)X3474(of)X3561(the)X3679(bucket)X3913(address,)X2418 3560(and)N2563(the)X2690(use)X2825(of)X2920(different)X3225(hash)X3400(functions)X3726(make)X3928(the)X4054(two)X2418 3648(incompatible)N2856(at)X2934(the)X3052(database)X3349(level.)X2590 3762(The)N2 f2740(sdbm)X1 f2934(library)X3173(is)X3251(based)X3458(on)X3562(a)X3622(simpli\256ed)X3965(imple-)X2418 3850(mentation)N2778(of)X2885(Larson's)X3206(1978)X2 f3406(dynamic)X3717(hashing)X1 f4009(algo-)X2418 3938(rithm)N2616(including)X2943(the)X2 f3066(re\256nements)X3461(and)X3605(variations)X1 f3953(of)X4044(sec-)X2418 4026(tion)N2562(5)X2622([LAR78].)X2956(Larson's)X3257(original)X3526(algorithm)X3857(calls)X4024(for)X4138(a)X2418 4114(forest)N2635(of)X2736(binary)X2975(hash)X3156(trees)X3341(that)X3494(are)X3626(accessed)X3941(by)X4054(two)X2418 4202(hash)N2586(functions.)X2925(The)X3071(\256rst)X3216(hash)X3384(function)X3672(selects)X3907(a)X3964(partic-)X2418 4290(ular)N2571(tree)X2720(within)X2952(the)X3078(forest.)X3309(The)X3462(second)X3713(hash)X3887(function,)X2418 4378(which)N2659(is)X2757(required)X3070(to)X3177(be)X3297(a)X3377(boolean)X3675(pseudo-random)X2418 4466(number)N2687(generator)X3015(that)X3159(is)X3236(seeded)X3479(by)X3583(the)X3705(key,)X3865(is)X3942(used)X4112(to)X2418 4554(traverse)N2733(the)X2890(tree)X3070(until)X3275(internal)X3579(\(split\))X3829(nodes)X4075(are)X2418 4642(exhausted)N2763(and)X2903(an)X3003(external)X3286(\(non-split\))X3648(node)X3827(is)X3903(reached.)X2418 4730(The)N2571(bucket)X2813(addresses)X3149(are)X3276(stored)X3500(directly)X3772(in)X3861(the)X3986(exter-)X2418 4818(nal)N2536(nodes.)X2590 4932(Larson's)N2903(re\256nements)X3309(are)X3440(based)X3655(on)X3767(the)X3897(observa-)X2418 5020(tion)N2570(that)X2718(the)X2844(nodes)X3059(can)X3199(be)X3303(represented)X3702(by)X3809(a)X3872(single)X4090(bit)X2418 5108(that)N2569(is)X2653(set)X2773(for)X2898(internal)X3174(nodes)X3392(and)X3539(not)X3672(set)X3791(for)X3915(external)X2418 5196(nodes,)N2652(resulting)X2959(in)X3048(a)X3111(radix)X3303(search)X3536(trie.)X3709(Figure)X3944(1)X4010(illus-)X2418 5284(trates)N2621(this.)X2804(Nodes)X3037(A)X3123(and)X3267(B)X3348(are)X3475(internal)X3748(\(split\))X3967(nodes,)X2418 5372(thus)N2573(having)X2813(no)X2915(bucket)X3151(addresses)X3480(associated)X3831(with)X3994(them.)X2418 5460(Instead,)N2693(the)X2814(external)X3096(nodes)X3306(\(C,)X3429(D,)X3530(and)X3669(E\))X3768(each)X3938(need)X4112(to)X2418 5548(refer)N2594(to)X2679(a)X2738(bucket)X2975(address.)X3279(These)X3494(bucket)X3731(addresses)X4062(can)X2418 5636(be)N2529(stored)X2760(in)X2857(the)X2990(trie)X3132(itself)X3327(where)X3559(the)X3691(subtries)X3974(would)X3 f432 5960(2)N2970(USENIX)X9 f3292(-)X3 f3356(Winter)X3621('91)X9 f3748(-)X3 f3812(Dallas,)X4065(TX)X3 p%%Page: 3 30(Courier)xf 0 f10 s 10 xH 0 xS 0 f3 f720 258(Seltzer)N977(&)X1064(Yigit)X3278(A)X3356(New)X3528(Hashing)X3831(Package)X4136(for)X4259(UNIX)X1 f720 538(live)N862(if)X933(they)X1092(existed)X1340([KNU68].)X1709(For)X1841(example,)X2154(if)X2224(nodes)X2432(F)X720 626(and)N858(G)X938(were)X1117(the)X1237(children)X1522(of)X1610(node)X1787(C,)X1881(the)X2000(bucket)X2235(address)X720 714(L00)N886(could)X1101(reside)X1330(in)X1429(the)X1563(bits)X1714(that)X1870(will)X2030(eventually)X2400(be)X720 802(used)N887(to)X969(store)X1145(nodes)X1352(F)X1416(and)X1552(G)X1630(and)X1766(all)X1866(their)X2033(children.)X10 f720 890 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN3 f1894 2247(L1)N784 1925(A)N1431(E)X1106 2247(D)N1428 1281(C)N1109 1603(B)N1884 1930(L01)N1879 1286(L00)N1221 1814(1)N903 2131(1)N1221 1402(0)N903 1714(0)N1 Dt1397 1821 MXY-8 -32 Dl-5 19 Dl-20 6 Dl33 7 Dl-187 -182 Dl1397 1322 MXY-33 7 Dl20 6 Dl5 19 Dl8 -32 Dl-187 182 Dl1069 1639 MXY-32 7 Dl20 6 Dl5 19 Dl7 -32 Dl-186 182 Dl1374 1891 MXY185 Dc1779 2133 MXY0 161 Dl322 0 Dl0 -161 Dl-322 0 Dl1811 MY0 161 Dl322 0 Dl0 -161 Dl-322 0 Dl1166 MY0 161 Dl322 0 Dl0 -161 Dl-322 0 Dl1052 2213 MXY185 Dc1569 MY185 Dc720 1881 MXY185 Dc1779 2213 MXY-28 -17 Dl10 17 Dl-10 18 Dl28 -18 Dl-543 0 Dl1769 1891 MXY-28 -18 Dl10 18 Dl-10 18 Dl28 -18 Dl-201 0 Dl1364 1247 MXY185 Dc1769 MX-28 -18 Dl10 18 Dl-10 18 Dl28 -18 Dl-201 0 Dl1064 2143 MXY-7 -32 Dl-5 19 Dl-20 6 Dl32 7 Dl-181 -181 Dl3 Dt-1 Ds8 s720 2482(Figure)N925(1:)X1 f1002(Radix)X1179(search)X1365(trie)X1474(with)X1612(internal)X1831(nodes)X2004(A)X2074(and)X2189(B,)X2271(external)X720 2570(nodes)N891(C,)X972(D,)X1056(and)X1170(E,)X1247(and)X1361(bucket)X1553(addresses)X1819(stored)X1997(in)X2069(the)X2168(unused)X2370(por-)X720 2658(tion)N836(of)X905(the)X999(trie.)X10 s10 f720 2922 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN1 f892 3124(Further)N1153(simpli\256cations)X1647(of)X1738(the)X1860(above)X2076([YIG89])X2377(are)X720 3212(possible.)N1038(Using)X1265(a)X1337(single)X1564(radix)X1765(trie)X1908(to)X2006(avoid)X2219(the)X2352(\256rst)X720 3300(hash)N904(function,)X1227(replacing)X1562(the)X1696(pseudo-random)X2231(number)X720 3388(generator)N1052(with)X1222(a)X1286(well)X1452(designed,)X1785(bit-randomizing)X2329(hash)X720 3476(function,)N1053(and)X1215(using)X1434(the)X1578(portion)X1855(of)X1967(the)X2110(hash)X2302(value)X720 3564(exposed)N1021(during)X1268(the)X1404(trie)X1549(traversal)X1864(as)X1969(a)X2042(direct)X2262(bucket)X720 3652(address)N990(results)X1228(in)X1319(an)X2 f1424(access)X1 f1663(function)X1959(that)X2108(works)X2333(very)X720 3740(similar)N974(to)X1068(Thompson's)X1499(algorithm)X1841(above.)X2084(The)X2240(follow-)X720 3828(ing)N847(algorithm)X1183(uses)X1346(the)X1469(hash)X1641(value)X1840(to)X1927(traverse)X2206(a)X2266(linear-)X720 3916(ized)N874(radix)X1059(trie)X2 f8 s1166 3891(3)N1 f10 s1218 3916(starting)N1478(at)X1556(the)X1674(0)X2 f7 s3884(th)Y10 s1 f1791 3916(bit.)N0 f8 s720 4215(tbit)N910(=)X986(0;)X1296(/*)X1410(radix)X1638(trie)X1828(index)X2056(*/)X720 4303(hbit)N910(=)X986(0;)X1296(/*)X1410(hash)X1600(bit)X1752(index)X2056(*/)X720 4391(mask)N910(=)X986(0;)X720 4479(hash)N910(=)X986 -0.4038(calchash\(key\);)AX720 4655(for)N872(\(mask)X1100(=)X1176(0;)X910 4743 -0.4018(isbitset\(tbit\);)AN910 4831(mask)N1100(=)X1176(\(mask)X1404(<<)X1518(1\))X1632(+)X1708(1\))X1008 4919(if)N1122(\(hash)X1350(&)X1426(\(1)X1540(<<)X1654 -0.4219(hbit++\)\)\))AX1160 5007(/*)N1274(right)X1502(son)X1692(*/)X1160 5095(tbit)N1350(=)X1426(2)X1502(*)X1578(tbit)X1768(+)X1844(2;)X1008 5183(else)N1 f16 s720 5353 MXY864 0 Dl2 f8 s760 5408(3)N1 f9 s818 5433(A)N896(linearized)X1206(radix)X1380(trie)X1502(is)X1576(merely)X1802(an)X1895(array)X2068(representation)X720 5513(of)N800(the)X908(radix)X1076(search)X1280(trie)X1396(described)X1692(above.)X1920(The)X2052(children)X2308(of)X2388(the)X720 5593(node)N885(with)X1038(index)X1223(i)X1267(can)X1391(be)X1483(found)X1675(at)X1751(the)X1863(nodes)X2055(indexed)X2307(2*i+1)X720 5673(and)N842(2*i+2.)X0 f8 s3146 538(/*)N3260(left)X3450(son)X3678(*/)X3146 626(tbit)N3336(=)X3412(2)X3488(*)X3564(tbit)X3754(+)X3830(1;)X2706 802(bucket)N2972(=)X3048(hash)X3238(&)X3314(mask;)X2 f10 s3495 1167(gdbm)N1 f2878 1299(The)N3027(gdbm)X3233(\(GNU)X3458(data)X3616(base)X3783(manager\))X4111(library)X4349(is)X4426(a)X2706 1387(UNIX)N2933(database)X3236(manager)X3539(written)X3792(by)X3897(Philip)X4112(A.)X4215(Nelson,)X2706 1475(and)N2848(made)X3048(available)X3364(as)X3457(a)X3518(part)X3668(of)X3760(the)X3883(FSF)X4040(software)X4342(dis-)X2706 1563(tribution.)N3052(The)X3207(gdbm)X3419(library)X3663(provides)X3969(the)X4097(same)X4292(func-)X2706 1651(tionality)N3028(of)X3151(the)X2 f3304(dbm)X1 f3442(/)X2 f3464(ndbm)X1 f3697(libraries)X4015([NEL90])X4360(but)X2706 1739(attempts)N3018(to)X3121(avoid)X3340(some)X3550(of)X3658(their)X3846(shortcomings.)X4337(The)X2706 1827(gdbm)N2918(library)X3162(allows)X3401(for)X3525(arbitrary-length)X4059(data,)X4242(and)X4387(its)X2706 1915(database)N3027(is)X
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -