Digital Signature Algorithm (DSA)是Schnorr和ElGamal簽名算法的變種,被美國NIST作為DSS(DigitalSignature Standard)。算法中應(yīng)用了下述參數(shù):
p:L bits長的素?cái)?shù)。L是64的倍數(shù),范圍是512到1024;
q:p - 1的160bits的素因子;
g:g = h^((p-1)/q) mod p,h滿足h < p - 1, h^((p-1)/q) mod p > 1;
x:x < q,x為私鑰 ;
y:y = g^x mod p ,( p, q, g, y )為公鑰;
H( x ):One-Way Hash函數(shù)。DSS中選用SHA( Secure Hash Algorithm )。
p, q, g可由一組用戶共享,但在實(shí)際應(yīng)用中,使用公共模數(shù)可能會(huì)帶來一定的威脅。簽名及驗(yàn)證協(xié)議如下:
1. P產(chǎn)生隨機(jī)數(shù)k,k < q;
2. P計(jì)算 r = ( g^k mod p ) mod q
s = ( k^(-1) (H(m) + xr)) mod q
簽名結(jié)果是( m, r, s )。
3. 驗(yàn)證時(shí)計(jì)算 w = s^(-1)mod q
u1 = ( H( m ) * w ) mod q
u2 = ( r * w ) mod q
v = (( g^u1 * y^u2 ) mod p ) mod q
若v = r,則認(rèn)為簽名有效。
DSA是基于整數(shù)有限域離散對(duì)數(shù)難題的,其安全性與RSA相比差不多。DSA的一個(gè)重要特點(diǎn)是兩個(gè)素?cái)?shù)公開,這樣,當(dāng)使用別人的p和q時(shí),即使不知道私鑰,你也能確認(rèn)它們是否是隨機(jī)產(chǎn)生的,還是作了手腳。RSA算法卻作不到。
標(biāo)簽:
Algorithm
Signature
Digital
Schnorr
上傳時(shí)間:
2014-01-01
上傳用戶:qq521
width = gdk_pixbuf_animation_get_width(ani)
height = gdk_pixbuf_animation_get_height(ani)
current_frame_list = gdk_pixbuf_animation_get_frames(ani)
pixmap = gdk_pixmap_new(w->window, width, height, -1)
clean_pixmap = gdk_pixmap_new(w->window, width, height, -1)
if (w->style->bg_pixmap[GTK_STATE_NORMAL]) {
GdkPixmap *bg = w->style->bg_pixmap[GTK_STATE_NORMAL]
GdkGC *gc
GdkGCValues values
values.tile = bg
values.fill = GDK_TILED
gc = gdk_gc_new_with_values(w->window, &values,
GDK_GC_FILL|GDK_GC_TILE)
gdk_gc_set_ts_origin(gc,
(w->allocation.width - width)/2,
(w->allocation.height-height)/2)
gdk_draw_rectangle(clean_pixmap,gc, TRUE,
0, 0, width, height)
gdk_gc_destroy(gc)
} else {
gdk_draw_rectangle(clean_pixmap,
w->style->bg_gc[GTK_STATE_NORMAL],
TRUE, 0, 0, width, height)
}
標(biāo)簽:
gdk_pixbuf_animation_get_height
gdk_pixbuf_animation_get_width
ani
height
上傳時(shí)間:
2013-12-26
上傳用戶:thinode