Python - Hmac. Phyton vs Visual Basic

 
Vista:

Hmac. Phyton vs Visual Basic

Publicado por lumbanico (1 intervención) el 22/05/2015 10:01:56
Hola a todos,

Estoy intentando desarrollar una aplicación tanto en Visual Basic como en Python, y no sé por qué las sigueintes funciones no me devuelven el mismo valor:

- Python:
1
2
3
import hmac
digest = hmac.new("1", "1", hashlib.sha1).hexdigest()
print digest

- Visual Basic:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Dim lngLoop As Long
Dim oUTF, oEnc
Dim HMAC() As Byte
Dim strText As String
Dim strTemp As String
Set oUTF = CreateObject("System.Text.UTF8Encoding")
Set oEnc = CreateObject("System.Security.Cryptography.HMACSHA1") '256
oEnc.Key = oUTF.Getbytes_4("1")
HMAC = oEnc.ComputeHash_2(oUTF.Getbytes_4("1"))
For lngLoop = 0 To UBound(HMAC)
	strTemp = strTemp & UCase(Right("0" & Hex(HMAC(lngLoop)), 2))
Next

msgbox strTemp

¿ Alguien sabe por qué ?. Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder