mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-27 04:36:19 +08:00
padding: use new function clear()
This commit is contained in:
parent
51a003b022
commit
a98b806453
@ -17,9 +17,7 @@ func (pad ansiX923Padding) Pad(src []byte) []byte {
|
||||
overhead := pad.BlockSize() - len(src)%pad.BlockSize()
|
||||
ret, out := alias.SliceForAppend(src, overhead)
|
||||
out[overhead-1] = byte(overhead)
|
||||
for i := 0; i < overhead-1; i++ {
|
||||
out[i] = 0
|
||||
}
|
||||
clear(out[:overhead-1])
|
||||
return ret
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,7 @@ func (pad iso9797M2Padding) Pad(src []byte) []byte {
|
||||
overhead := pad.BlockSize() - len(src)%pad.BlockSize()
|
||||
ret, out := alias.SliceForAppend(src, overhead)
|
||||
out[0] = 0x80
|
||||
for i := 1; i < overhead; i++ {
|
||||
out[i] = 0
|
||||
}
|
||||
clear(out[1:overhead])
|
||||
return ret
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user