package hashrng

import (
	"time"

	"xdx.jelly/xgcl/grand/drng/internal"
)

var defaultConfig1 = &internal.DrngConfig{
	Seedlen:                 440 >> 3,
	Outlen:                  256 >> 3,
	ReseedIntervalInTime:    time.Second * 600,
	ReseedIntervalInCounter: 1 << 20,
	MinEntropy:              256 >> 3,
	MinEntropyInputLength:   256 >> 3,
	MaxEntropyInputLength:   (1 << 35) >> 3,
}

// 安全级别2的配置
var defaultConfig2 = &internal.DrngConfig{
	Seedlen:                 440 >> 3,
	Outlen:                  256 >> 3,
	ReseedIntervalInTime:    time.Second * 60,
	ReseedIntervalInCounter: 1 << 10,
	MinEntropy:              256 >> 3,
	MinEntropyInputLength:   256 >> 3,
	MaxEntropyInputLength:   (1 << 35) >> 3,
}

func Config(level internal.SecureLevel) *internal.DrngConfig {
	switch level {
	case internal.SecureLevel1:
		return defaultConfig1
	case internal.SecureLevel2:
		return defaultConfig2
	default:
		panic("unsupported secure level")
	}
}
