Newsgroup: it.comp.lang.visual-basic
Titolo: One Way HASH


'
' --- Start of uselessness
'
' Disclaimer:
'
' The software is provided AS IS, and the author hereby disclaims all
' and every warranties and conditions, either express, implied or statutory,
' including, but not limited to, any (if any) implied warranties, duties or
' conditions of merchantability, of fitness for a particular purpose, of
' accuracy or completeness of responses, of results, of workmanlike effort,
' of lack of viruses, and of lack of negligence
'
' IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
' INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
' WHATSOEVER (INCLUDING, BUT NOT LIMITED TO, DAMAGES
' FOR LOSS OF PROFITS OR CONFIDENTIAL OR OTHER
' INFORMATION, FOR BUSINESS INTERRUPTION, FOR PERSONAL
' INJURY, FOR LOSS OF PRIVACY, FOR FAILURE TO MEET ANY
' DUTY INCLUDING OF GOOD FAITH OR OF REASONABLE CARE,
' FOR NEGLIGENCE, AND FOR ANY OTHER PECUNIARY OR OTHER
' LOSS WHATSOEVER) ARISING OUT OF OR IN ANY WAY
' RELATED TO THE USE OF OR INABILITY TO USE THE SOFTWARE,
' EVEN IN THE EVENT OF THE FAULT, TORT (INCLUDING
' NEGLIGENCE), STRICT LIABILITY, AND EVEN IF THE AUTHOR
' HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
'
' By using the software you agree to be bound by the terms above.
'
' You can modify the software and use it for your programs, under the terms
of
' the GNU GENERAL PUBLIC LICENSE (GPL).
' By using the software you agree to be bound by the terms of the GNU GPL.
'
' See the free software foundation web site (
www.gnu.org
) for further
details
' about the GNU GPL.
' --- End of uselessness
Type HASH
    A As Byte
    B As Byte
    C As Byte
    D As Byte
    E As Byte
    F As Byte
    G As Byte
    H As Byte
End Type
Private Const A = 3
Private Const B = 5
Private Const C = 2
Function MAKE_HASH(PlainText$) As HASH
    Dim HSH_Temp As HASH
    Dim I&, J&, Y&(7), x&
    Dim S() As Byte
    If Len(PlainText) < 1 Then
        ' Hash di nessun testo
        HSH_Temp.A = 0
        HSH_Temp.B = 0
        HSH_Temp.C = 0
        HSH_Temp.D = 0
        HSH_Temp.E = 0
        HSH_Temp.F = 0
        HSH_Temp.G = 0
        HSH_Temp.H = 0
        MAKE_HASH = HSH_Temp
        Exit Function
    End If
    ' Codifica usando la parabola y = 3 * x ^ 2 + 5 * x + 2
    ' Cambiare le costanti per cambiare la parabola
    S = PlainText
    J = 0
    For I = 0 To 6
        ' Calcolo di Y
        For J = J To (I + 1) * (UBound(S) \ (Len(HSH_Temp) - 1))
            x = (x + S(J)) Mod 256
        Next J
        Y(I) = (A * x ^ 2 + B * x + C) Mod 256
    Next I
    ' Calcolo di Y
    For J = J To J + UBound(S) Mod (Len(HSH_Temp) - 1) - 1
        x = (x + S(J)) Mod 256
    Next J
    Y(I) = (A * x ^ 2 + B * x + C) Mod 256
    ' Assegnazione alla struttura di uscita
    HSH_Temp.A = Y(0)
    HSH_Temp.B = Y(1)
    HSH_Temp.C = Y(2)
    HSH_Temp.D = Y(3)
    HSH_Temp.E = Y(4)
    HSH_Temp.F = Y(5)
    HSH_Temp.G = Y(6)
    HSH_Temp.H = Y(7)
    MAKE_HASH = HSH_Temp
End Function
' ------- End of Code
Ciaotutti,
Alessandro

 wrote in message
news:8tc6ks$bkg$1...@stargate1.inet.it...


 wrote in message
news:8tc6ks$bkg$1...@stargate1.inet.it...



In effetti un po' di casino ero riuscito a combinarmelo.
Ma a caval donato ...
Thx !
Ciao
Aldo

 wrote in message
8tc6ks$bkg$1...@stargate1.inet.it...
