Click here to Skip to main content
15,887,746 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Right Mouse Click in TextBox brings up strange menu Pin
KKW_acd15-Jan-15 6:48
KKW_acd15-Jan-15 6:48 
GeneralRe: Right Mouse Click in TextBox brings up strange menu Pin
CHill6015-Jan-15 6:57
mveCHill6015-Jan-15 6:57 
QuestionDJB2 Hash algorithm for VB Pin
SepPax13-Jan-15 11:39
SepPax13-Jan-15 11:39 
AnswerRe: DJB2 Hash algorithm for VB Pin
Richard MacCutchan13-Jan-15 21:53
mveRichard MacCutchan13-Jan-15 21:53 
GeneralRe: DJB2 Hash algorithm for VB Pin
SepPax14-Jan-15 6:33
SepPax14-Jan-15 6:33 
GeneralRe: DJB2 Hash algorithm for VB Pin
Richard MacCutchan14-Jan-15 6:58
mveRichard MacCutchan14-Jan-15 6:58 
GeneralRe: DJB2 Hash algorithm for VB Pin
SepPax14-Jan-15 9:54
SepPax14-Jan-15 9:54 
GeneralRe: DJB2 Hash algorithm for VB Pin
Richard MacCutchan14-Jan-15 23:44
mveRichard MacCutchan14-Jan-15 23:44 
Your logic is not the same as described in the algorithm (not sure why). Try:
VB
Public Function Hash_calc(frame As String)

    Dim hash As UInteger = 5831
    Dim nextChar As Char
    Dim temp As UInt32
    
    For i = 0 To frame.Length() - 1
    
        nextChar = frame.Substring(i, 1)
        temp = Convert.ToUInt32(nextChar)
        hash = hash * 33 + temp
    Next

    Hash_calc = hash
    
End Function

I have changed the function name to Hash_calc as that is more meaningful, this is a hashing algorithm, not a CRC. I also changed the integer declarations to UInteger as that makes more sense for use in a 32-bit or 64-bit application. Finally you need to switch off the overflow checking in your projects properties page in Visual Studio.
GeneralRe: DJB2 Hash algorithm for VB Pin
SepPax15-Jan-15 10:37
SepPax15-Jan-15 10:37 
GeneralRe: DJB2 Hash algorithm for VB Pin
Richard MacCutchan15-Jan-15 21:38
mveRichard MacCutchan15-Jan-15 21:38 
GeneralRe: DJB2 Hash algorithm for VB Pin
SepPax18-Jan-15 1:55
SepPax18-Jan-15 1:55 
GeneralRe: DJB2 Hash algorithm for VB Pin
Richard MacCutchan18-Jan-15 2:17
mveRichard MacCutchan18-Jan-15 2:17 
GeneralRe: DJB2 Hash algorithm for VB Pin
SepPax18-Jan-15 3:32
SepPax18-Jan-15 3:32 
GeneralRe: DJB2 Hash algorithm for VB Pin
SepPax18-Jan-15 9:02
SepPax18-Jan-15 9:02 
QuestionVisual Studio 2010 Express on Windows 8.1 Pin
BobbyStrain12-Jan-15 14:11
BobbyStrain12-Jan-15 14:11 
AnswerRe: Visual Studio 2010 Express on Windows 8.1 Pin
vbmike13-Jan-15 4:15
vbmike13-Jan-15 4:15 
AnswerRe: Visual Studio 2010 Express on Windows 8.1 Pin
RUs12313-Jan-15 4:19
RUs12313-Jan-15 4:19 
GeneralRe: Visual Studio 2010 Express on Windows 8.1 Pin
BobbyStrain13-Jan-15 5:06
BobbyStrain13-Jan-15 5:06 
QuestionWhy this expression produce error Pin
dilkonika12-Jan-15 6:31
dilkonika12-Jan-15 6:31 
AnswerRe: Why this expression produce error Pin
Richard Deeming12-Jan-15 6:56
mveRichard Deeming12-Jan-15 6:56 
GeneralRe: Why this expression produce error Pin
dilkonika12-Jan-15 7:12
dilkonika12-Jan-15 7:12 
AnswerRe: Why this expression produce error Pin
ZurdoDev12-Jan-15 7:23
professionalZurdoDev12-Jan-15 7:23 
GeneralRe: Why this expression produce error Pin
dilkonika12-Jan-15 7:32
dilkonika12-Jan-15 7:32 
GeneralRe: Why this expression produce error Pin
ZurdoDev12-Jan-15 7:38
professionalZurdoDev12-Jan-15 7:38 
GeneralRe: Why this expression produce error Pin
dilkonika12-Jan-15 7:50
dilkonika12-Jan-15 7:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.