mirror of
https://github.com/qrtc/ffmpeg-dev-go.git
synced 2025-10-05 15:47:33 +08:00
2023-10-26 13:54:33 CST W43D4
This commit is contained in:
29
avutil_sha.go
Normal file
29
avutil_sha.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
#include <libavutil/sha.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// AVSHA
|
||||
type AVSHA C.struct_AVSHA
|
||||
|
||||
// AvShaAlloc allocates an AVSHA context.
|
||||
func AvShaAlloc() *AVSHA {
|
||||
return (*AVSHA)(C.av_sha_alloc())
|
||||
}
|
||||
|
||||
// AvShaInit initializes SHA-1 or SHA-2 hashing.
|
||||
func AvShaInit(context *AVSHA, bits int32) int32 {
|
||||
return (int32)(C.av_sha_init((*C.struct_AVSHA)(context), (C.int)(bits)))
|
||||
}
|
||||
|
||||
// AvShaUpdate updates hash value.
|
||||
func AvShaUpdate(ctx *AVSHA, data *uint8, len uint32) {
|
||||
C.av_sha_update((*C.struct_AVSHA)(ctx), (*C.uint8_t)(data), (C.uint)(len))
|
||||
}
|
||||
|
||||
// AvShaFinal finishes hashing and output digest value.
|
||||
func AvShaFinal(ctx *AVSHA, digest *uint8) {
|
||||
C.av_sha_final((*C.struct_AVSHA)(ctx), (*C.uint8_t)(digest))
|
||||
}
|
Reference in New Issue
Block a user