Создание простой кодировки base64 в качестве примера.Проблема в том, что при сохранении результатов (закодированной строки) в БД доступа возвращаемая строка больше, чем поле БД позволит?максимальная длина поля 255. Почему результат для средней строки из 8-15 символов дает результат в 350+ символов.пример соли "abcdefgh"
Public Function EncodePassword(ByVal pass As String, ByVal passwordFormat As Integer, ByVal salt As String) As String
If passwordFormat = 0 Then Return pass
Dim bIn As Byte() = Encoding.Unicode.GetBytes(pass)
Dim bSalt As Byte() = Convert.FromBase64String(salt)
Dim bAll As Byte() = New Byte(bSalt.Length + bIn.Length - 1) {}
Dim bRet As Byte() = Nothing
Buffer.BlockCopy(bSalt, 0, bAll, 0, bSalt.Length)
Buffer.BlockCopy(bIn, 0, bAll, bSalt.Length, bIn.Length)
If passwordFormat = 1 Then
Dim s As HashAlgorithm = HashAlgorithm.Create(_HashAlgorithmType)
If s Is Nothing Then
Throw New ProviderException("Could not create a hash algorithm")
End If
bRet = s.ComputeHash(bAll)
Else
bRet = EncryptPassword(bAll)
End If
Return Convert.ToBase64String(bRet)
End Function