Sérgio,

I use .hrb a lot and I write them inside of my RDBMS. So I use the
Base64 to convert binaries files to a ASC string like Base64. Here are
the functions that I use:

Function Base64Decode( cFile, cData )
    Local oEncoder
    Local nHandle
    Local result := .t.

    oEncoder := TIPEncoder():New( "base64" )

    if (nHandle := FCreate(cFile)) != -1
        cData := oEncoder:Decode(cData)
        FWrite(nHandle, cData)
        FClose(nHandle)
    else
        result := .f.
    endif
return result


Function Base64Encode( cFile, cData )
    Local oEncoder
    Local cBuffer := Space(1024)
    Local nHandle
    Local nLen
    Local result := .t.

    oEncoder := TIPEncoder():New( "base64" )

    if (nHandle := FOpen(cFile)) != -1
        cData := ""
        nLen := FRead( nHandle, @cBuffer, 1024 )

        do while nLen > 0
            if nLen < 1024
                cData += Substr( cBuffer, 1, nLen )
            else
                cData += cBuffer
            endif
            nLen := FRead( nHandle, @cBuffer, 1024 )
        enddo

        cData := oEncoder:Encode(cData)
        FClose(nHandle)
    else
        result := .f.
    endif
return result

Regards,
Rodrigo



On Mon, Jan 26, 2009 at 11:38 PM, Sérgio Kondo <cig...@hotmail.com> wrote:
> Hi,
> Is possible to compact .hrb files or encrypt string in .hrb files?
> My interest is hide password string in .hrb files, if I put password string
> in this file.
> Sérgio
>
> _______________________________________________
> Harbour mailing list
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour
>
>
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to