GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEV
,
WEBDEV
e
WINDEV Mobile
Inicio
|
Mensagens recentes
|
Conecte-se...
|
Disconnect
|
Português
Inicio
→
WEBDEV 2024
→
PHP - SHA1 Issue
PHP - SHA1 Issue
Iniciado por Mark, jul., 25 2017 1:34 PM - 1 resposta
Conecte-se…
Mark
#1
Publicado em julho, 25 2017 - 1:34 PM
We're working on moving an existing site over from PHP/MySQL to AWP. We are having an issue with existing passwords which were encrypted using SHA1. The 60 character hex string in the password fields do not match what we're getting when we run the HashString function in the function below:
PROCEDURE SHA1HashStringToHex(LOCAL psStringToHash is string)
LOCAL
lbufHashed is Buffer
lcChar is character = ""
liPos is int = 0
liLen is int = 0
lsHexResult is string = ""
lbufHashed = HashString(HA_SHA_160, NoSpace(psStringToHash))
liLen = Length(lbufHashed)
FOR liPos = 1 TO liLen
lcChar = lbufHashed[[liPos]]
lsHexResult += NumToString(Asc(lcChar),"1x")
END
RESULT = lsHexResult
Thanks,
Mark
Denunciar
0
0
Fabrice Harari
#2
Publicado em julho, 25 2017 - 2:20 PM
Hi Mark,
"1x"?
A character value goes from 0 to 255, so you should probably use 2x
instead, as the 1 gives you only ONE hex character in output.
or simply use buffertohexa instead of your loop
Best regards
--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting
Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)
More information on
http://www.fabriceharari.com
Le 7/25/2017 à 5:34 AM, Mark a écrit :
We're working on moving an existing site over from PHP/MySQL to AWP. We
are having an issue with existing passwords which were encrypted using
SHA1. The 60 character hex string in the password fields do not match
what we're getting when we run the HashString function in the function
below:
PROCEDURE SHA1HashStringToHex(LOCAL psStringToHash is string)
LOCAL
lbufHashed is Buffer lcChar is character = ""
liPos is int = 0
liLen is int = 0
lsHexResult is string = ""
lbufHashed = HashString(HA_SHA_160, NoSpace(psStringToHash))
liLen = Length(lbufHashed)
FOR liPos = 1 TO liLen lcChar = lbufHashed[[liPos]]
lsHexResult += NumToString(Asc(lcChar),"1x")
END
RESULT = lsHexResult
Thanks,
Mark
Denunciar
0
0
→ Voltar para WEBDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versões anteriores)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Tipo de Pesquisa
Apenas tópicos
Todas as mensagens
Período de pesquisa
Qualquer momento
Última hora
Últimas 24 horas
Semana passada
Mês passado
Ano passado
Cancelar
Pré-visualização da sua mensagem
Adicionar imagem
Importar uma imagem de uma URL
Enviar uma imagem a partir do seu disco
Deixe um ficheiro ou clique em "Procurar ..."
ou
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto