1
0
mirror of https://github.com/drakkan/sftpgo.git synced 2025-11-29 22:08:10 +02:00

add support for checking pbkdf2 passwords

This commit is contained in:
Nicola Murino
2019-08-17 15:20:49 +02:00
parent 9d342cb125
commit 133f2e8601
4 changed files with 70 additions and 6 deletions

View File

@@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/drakkan/sftpgo/logger"
@@ -22,6 +23,17 @@ func IsStringInSlice(obj string, list []string) bool {
return false
}
// IsStringPrefixInSlice searches a string prefix in a slice and returns true
// if a matching prefix is found
func IsStringPrefixInSlice(obj string, list []string) bool {
for _, v := range list {
if strings.HasPrefix(obj, v) {
return true
}
}
return false
}
// GetTimeAsMsSinceEpoch returns unix timestamp as milliseconds from a time struct
func GetTimeAsMsSinceEpoch(t time.Time) int64 {
return t.UnixNano() / 1000000