Buchempfehlung
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Umfassend, aber leicht verständlich führt dieses Buch in die Programmierung von ATMEL AVR Mikrocontrollern ein. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

dofda1.bas

Uploader:Mitgliedcsde_rats
Datum/Zeit:26.11.2007 23:27:53

/'
    DOFDA1
    data or file digest algorithm 1
    

    (c) 2007 Marian Beermann
             aka csde_rats
            
    
'/


#Include "dofda1.bi"

Function dofda1_version() As String Export
    Dim Version As String
    Version = __DATE__               & Chr(10,13) & _
              __FB_LANG__            & Chr(10,13) & _
              "FB VER: "             & _
              __FB_VERSION__         & _
              "."                    & _
              __FB_VER_PATCH__       & _
              "LIB VER:"             & _
              ThisDOFDA1Version

    Return Version
End Function

Function dofda1_compatiblever(dd As dofda1_desc) As Boolean Export
    If dd.DOFDA_VER <> ThisDOFDA1Version Then Return FALSE Else Return TRUE
End Function

Function dofda1_hashblock(cContext As dofda1_context, iBlockNumber As ULongInt) As dofda1_context Export
    Dim Block As dofda1_block
    Dim Headr As dofda1_desc
    Dim As ULongInt iProcBlocks, iWrkdBlocks, iBlockNum
    Dim sHash As String * HashLen

    With cContext
        Headr                           = .Desc
        Block                           = .ubRawBlocks(iBlockNumber)
        iProcBlocks                     = .iProceedBlocks
        iBlockNum                       = .iBlockNum
    End With

    iWrkdBlocks = iBlockNum - iProcBlocks
    sHash = String(HashLen, EmptyChar)

    For iC As Integer = 0 To BlockLen
        *(@sHash[iC]) = Chr( _
                             Block.dat(iC) = _
                             Block.dat(iC) _
                             And _
                             Cast( _
                              UByte, _
                              Asc( _
                               *( _
                                 @sHash[iC] _
                                ) _
                              ) _
                             ) _
                           )
    Next

    Block.sHash = sHash
    cContext.ubRawBlocks(iBlockNumber) = Block

    Return cContext
End Function