Hello, I have a big problem!
I get back a file ini, everything goes well, it corresponds to what I want.
Then, I read the value "pass" of the ini file.
And, when I compare the value return of my Sha512 with the value "pass" of the ini file, He says that it is different! but nevertheless they are similar!
French :
Bonjours, j'ai un gros problème
J'ai un fichier ini que je lis, tout ce passe bien.
Je récupére la valeur "pass" du fichier ini.
Et, quand je compare la valeur retourner de ma fonction Sha512 avec la valeur "pass" du fichier ini, il me dit que c'est différent pourtant ils sont pareils ! (j'ai fait le test avec des msgbox !)
Msgbox the both values and check where is the problem.
Dec 23, 2013 09:07 AM
(This post was last modified: Dec 23, 2013 09:59 AM by Brokeos.)
I already checked x)
[image deleted !]
Put .Trim at the end of both values. It might be a space which makes the difference.
BlackCap Wrote:You're even more verbose than Java. About using GoTo's in VB/C#:
Only3 Wrote:asm use it why u shouldnt
No, I tested everything !
If you want, I load the project and I'll send?
Dec 23, 2013 09:44 AM
(This post was last modified: Dec 23, 2013 09:45 AM by 0xDEAD10CC.)
If you tested everything and it isn't working then you are doing something wrong; you didn't test everything. Post the relevant code, and show what the values are that are being compared. They are different.
Breakpoint and see the hash to hash comparison.
Dec 23, 2013 09:51 AM
(This post was last modified: Dec 23, 2013 09:51 AM by Brokeos.)
I found, even if it is not very clean, I separate the "pass" profile file
Please show your code. Can't really help much without it.
Did you hash the input and check it with the value in the ini file?
Is the value in the ini file a SHA512 hash also?
Try adding a msgbox to display both the values so you can see the difference for yourself?
Trim the end, then, if it is a string, try using String.Equals()
Dec 23, 2013 03:30 PM
(This post was last modified: Dec 23, 2013 03:36 PM by 0xDEAD10CC.)
(Dec 23, 2013 03:20 PM)Pseudocode Wrote: Trim the end, then, if it is a string, try using String.Equals()
Why would it not be a string if you can call a Trim function on the object? Aside from the fact that it is a string as mentioned.
However, this is literally a 5 second proof that could be configured to see that the values are probably different, and a 1-5 minute fix at most depending on how he's got everything implemented, and OP doesn't take our word for it. Let 'em have at it if he truly things those strings are the same IMO, lol.
@OP:
(Dec 23, 2013 09:51 AM)Brokeos Wrote: I found, even if it is not very clean, I separate the "pass" profile file
Btw, I replied. How does this have anything to do with the suggestions I posted? And how does it help us help you when it isn't even relevant to the question this thread's creation was based off of? 🤨 Separation of files has nothing to do with whether or not 2 strings are evaluating as equal or not.
1. Did you try breakpointing?
2. Did you post any code? (a bit rhetorical)
I haven't seen anything, and you expect to get help? ❓ We might as well just be running around like drunken blindfolded idiots with guns trying to shoot a target.
Code Private Sub btn_login_Click(sender As Object, e As EventArgs) Handles btn_login.Click
If txt_user.Text.Equals("") Or txt_pass.Text.Equals("") Then
MsgBox("Wrong data !", MsgBoxStyle.Critical)
Else
IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\CloudUp\settings.ini", DownloadSource(server & "users/" & txt_user.Text & "/account.info")
If ReadIni("Profil","pass",Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\CloudUp\settings.ini") = Sha512(txt_pass.Text) Then
WritePrivateProfileString("Login", "user", txt_user.Text, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\CloudUp\settings.ini")
WritePrivateProfileString("Login", "pass", txt_pass.Text, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\CloudUp\settings.ini")
MsgBox("Hello " & txt_user.Text & " !", MsgBoxStyle.Information)
user = txt_user.Text
Cloud.Show()
Me.Close()
Else
MsgBox("Wrong username or password !", MsgBoxStyle.Critical)
End If
IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\CloudUp\~temp.ini")
End If
End Sub
Sha512 Function = Original sha256 x2 (Sha256(Sha256(MyText)))
ReadIni Function =
Public Function ReadIni(ByVal cRubrique As String, ByVal cKey As String, ByVal cFileName As String) As String
Dim cRepertoire As String = Space(255)
Get_Private_Profile_String(cRubrique, cKey, "", cRepertoire, cFileName)
Return Trim(cRepertoire)
End Function
DownloadSource Function = Net.WebClient.DownloadString(url)
Dim cRepertoire As String = Space(255)
Check the lenght of both string (.Lenght())
I think one has 255 while the other way less.
BlackCap Wrote:You're even more verbose than Java. About using GoTo's in VB/C#:
Only3 Wrote:asm use it why u shouldnt
No, the function works well ;)
When I ask the pass value, she return good value ;)
(Dec 24, 2013 04:15 AM)Brokeos Wrote: No, the function works well ;)
When I ask the pass value, she return good value ;) How do you know it's a good value?
Just because they look the same doesn't mean they are the same (spaces)
BlackCap Wrote:You're even more verbose than Java. About using GoTo's in VB/C#:
Only3 Wrote:asm use it why u shouldnt
|