English
Forum

Problems with the Password function

 

Dirk
Kuntzmann
Hello Profaner,

I have today began one Progrann moreover To write, I 2005 began having (presumably Profan9). then running the program correct. today there apparently a problem with the values)-function where I do not faith the the Error in the program lying, there this already correct worked has. Getestet have I it today under windows2000 and Windows XP. It's all right here around the Verschlüsselung / Entschlüsselung of dBase-tables. Folgender Programmausschnitt ought to the trouble show:
CompileMarkSeparation
declare schrift%,feld$[5],datei$
DECLARE TEXT4&

proc testdateien_erstellen

    assign #1,artikel.str
    rewrite #1
    print #1,ARTIKEL;C;50;0
    print #1,GRUPPE;C;50;0
    print #1,KCAL;C;5;0
    print #1,PORTION;C;3;0
    close #1
    sleep 500
    db(create,artikel.str,test.dbf)

    if datei$=test.dbf

        dbopen(#1,datei$)
        db(go,|<)

        whilenot &dbRecNo=6

            db(appendblank)
            dbput(ARTIKEL,Name)
            dbput(GRUPPE,Gruppe)
            dbput(KCAL,500)
            dbput(PORTION,100)
            dbputrec(0)

        endwhile

        dbgo(5)

    else

        dbopen(#1,datei$)
        dbgo(5)

    endif

    settext text4&,trim$(dbget$(ARTIKEL))
    dbclose(#1)
    copy test.dbf > test1.dbf
    datei$=test1.dbf

endproc

proc rueckschluesseln

    DECLARE DLG&,DIALOGENDE%
    DECLARE TEXT1&,TEXT7&
    DECLARE TEXT2&,Text8&
    DECLARE TEXT3&
    DECLARE EDIT1&
    DECLARE TEXT5&,text6&
    DECLARE BUTTON1&,Button3&
    DECLARE BUTTON2&
    DLG&=CREATE(DIALOG,%HWND,Datenbank rückschlüsseln,351,293,292,213)
    TEXT7& =@CREATE(TEXT,DLG&,Quelle/Ziel:,0010,0010,0100,0020)
    TEXT1& =@CREATE(TEXT,DLG&,Daten vorher:,0010,0040,0100,0020)
    TEXT2& =@CREATE(TEXT,DLG&,Schlüssel:,0010,0070,0100,0020)
    TEXT3& =@CREATE(TEXT,DLG&,Daten nachher:,0010,0120,0100,0020)
    TEXT4& =@CREATE(TEXT,DLG&,,0115,0040,0150,0020)
    EDIT1& =@CREATE(EDIT,DLG&,,0115,0070,0150,0020)
    TEXT5& =@CREATE(TEXT,DLG&,,0115,0120,0150,0020)
    TEXT8& =@CREATE(TEXT,DLG&,,0010,0125,0150,0020)
    text6& =@CREATE(TEXT,DLG&,1. mit Reg-Code;2. mit 12345,0115,0090,0150,0020)
    BUTTON3& =@CREATE(BUTTON,DLG&,>,0110,0010,0020,0024)
    BUTTON1& =@CREATE(BUTTON,DLG&,OK,0010,0150,0070,0024)
    BUTTON2& =@CREATE(BUTTON,DLG&,Abbruch,0100,0150,0070,0024)
    SETFOCUS(edit1&)
    LET DIALOGENDE%=0

    WHILENOT DIALOGENDE%

        WAITINPUT

        If @EQU(%KEY,2)

            LET DIALOGENDE%= 1

        ELSEIF clicked(BUTTON1&) BUTTON

            if trim$(gettext$(edit1&))=

                setfocus(edit1&)

            else

                dbopen(#1,datei$)
                dbgo(|<)

                whilenot %dbeof

                    clear feld$[]
                    PASSWORD trim$(gettext$(edit1&))
                    feld$[1]=pwd$(trim$(dbget$(ARTIKEL)))
                    feld$[2]=pwd$(trim$(dbget$(GRUPPE)))
                    feld$[3]=pwd$(trim$(dbget$(KCAL)))
                    feld$[4]=pwd$(trim$(dbget$(PORTION)))
                    password
                    dbput(ARTIKEL,pwd$(feld$[1]))
                    dbput(GRUPPE,pwd$(feld$[2]))
                    dbput(KCAL,pwd$(feld$[3]))
                    dbput(PORTION,pwd$(feld$[4]))
                    dbputrec(0)
                    dbgo(>)

                wend

                dbclose(#1)
                sleep 500
                dbopen(#1,datei$)
                dbgo(5)
                settext text5&,trim$(dbget$(ARTIKEL))
                dbclose(#1)
                settext edit1&,

            endif

        ELSEIF clicked(BUTTON3&) BUTTON

            datei$=LoadFile$(Umschlüsseln von:,Test*.dbf)

            if datei$=test.dbf

                dbopen(#1,datei$)
                db(go,|<)

                whilenot &dbRecNo=6

                    db(appendblank)
                    dbput(ARTIKEL,Name)
                    dbput(GRUPPE,Gruppe)
                    dbput(KCAL,500)
                    dbput(PORTION,100)
                    dbputrec(0)

                endwhile

                dbgo(5)

            else

                dbopen(#1,datei$)
                dbgo(5)

            endif

            settext text4&,trim$(dbget$(ARTIKEL))
            dbclose(#1)

        ELSEIF clicked(BUTTON2&) BUTTON

            LET DIALOGENDE%= 1

        ENDIF

    WEND

    @DESTROYWINDOW(DLG&)

endproc

cls RGB(23,23,23)
traceon
showmax
let schrift%=create(font,Comic sans MS,16,0,0,0,0)
SETDIALOGFONT schrift%
datei$=test.dbf
testdateien_ers
rueckschluesseln end

I hope, I have The einzelenen Ausschnitte correctly. together knitted. After the Start go Testdateien prepares. then appear one dialog. with klick on the arrow appear a Dateiauswahl. Please The Test.dbf dial. Then in the dialog one Datenfeld displayed (unverschlüsselt name). now can one Key association go z. B. 1. After the verification with OK go The Datensätze verschlüsselt and the same area again displayed. gives one now again as Key a 1 one, should The Verschlüsselung cancelled go. unfortunately missing the first character. Gleiches happens with the input one individual a. gives one z. B. 12345 one operates everything correctly. with abc but not. here's a entschlüsselung none possible. there in the Help too no Einschränkungen made go like a values) looks should what about me faith, that the already once functions has, think I almost, the it itself for a trouble for Roland deals. but Perhaps übersehe so did i only slightly. for a Tipp would I grateful.

Greeting Dirk
 
07/27/07  
 




Michael
Wodrich
Testdateien_erstellen clutching on one Dialogfeld To, that first in the subesquent procedure prepares becomes.
I suppose, that You this Codeschnipsel not tested have.

2 Tipps:
a) send a functioning code
(Button 1 entschlüsselt whom Detenbankinhalt, the but nirgendwo verschlüsselt becomes)
b) save The Umsetzungen/Funktionsergebnisse in a Variables and use solely these Variable behind PASSWORD. so can You, the, what on values) transfer becomes before to check Show let.
its too possible, the PASSWORD here something sensitive reacted, what The length the Passwortes angeht. one ought to fundamentally no Passworte using The kürzer as 8 characters are. The 4stelligen Pins the Banken are a Sicherheits-Traumschloss. Diesen 4-numbers-code can with of/ one high Trefferquote even guess.

Lass simply whom computer time a 4stellige number detect and try 100x tappt im dunkeln To guess. The Number of hits says you The prozentuale Trefferquote. you become marvel.

Best wishes
Michael Wodrich

Nachtrag:
i'm first now noticed, the You with gesetztem PASSWORD The Datenbankinhalte entschlüsselst circa tappt im dunkeln then with gelöschtem again by the Schlüsselfunktion To send.
rather is it if you The File unverschlüsselt then without PWD$() save and the code a Own routine write. in the from you angegebenen shape functions both directions not.
 
Programmieren, das spannendste Detektivspiel der Welt.
07/27/07  
 




Michael
Wodrich
AUTSCH

The Error lying integrally simply in the TRIM$()-function. tappt im dunkeln removes too Steuerzeichen, The in the PWD-String but vorkommen.

this is in the Help Trim$ eindeutig differently described !!!

here the Testcode:
CompileMarkSeparation
declare schrift%,feld$[5],datei$
DECLARE TEXT4&

proc testdateien_erstellen

    assign #1,artikel.str
    rewrite #1
    print #1,ARTIKEL;C;50;0
    print #1,GRUPPE;C;50;0
    print #1,KCAL;C;5;0
    print #1,PORTION;C;3;0
    close #1
    sleep 500
    db(create,artikel.str,test.dbf)

    if datei$=test.dbf

        dbopen(#1,datei$)
        db(go,|<)

        whilenot &dbRecNo=6

            db(appendblank)
            dbput(ARTIKEL,Name)
            dbput(GRUPPE,Gruppe)
            dbput(KCAL,500)
            dbput(PORTION,100)
            dbputrec(0)

        endwhile

        dbgo(5)

    else

        dbopen(#1,datei$)
        dbgo(5)

    endif

    settext text4&,trim$(dbget$(ARTIKEL))
    dbclose(#1)
    copy test.dbf > test1.dbf
    datei$=test1.dbf

endproc

proc rueckschluesseln

    DECLARE DLG&,DIALOGENDE%
    DECLARE TEXT1&,TEXT7&
    DECLARE TEXT2&,Text8&
    DECLARE TEXT3&
    DECLARE EDIT1&
    DECLARE TEXT5&,text6&
    DECLARE BUTTON1&,Button3&
    DECLARE BUTTON2&
    DLG&=CREATE(DIALOG,%HWND,Datenbank rückschlüsseln,351,293,292,213)
    TEXT7& =@CREATE(TEXT,DLG&,Quelle/Ziel:,0010,0010,0100,0020)
    TEXT1& =@CREATE(TEXT,DLG&,Daten vorher:,0010,0040,0100,0020)
    TEXT2& =@CREATE(TEXT,DLG&,Schlüssel:,0010,0070,0100,0020)
    TEXT3& =@CREATE(TEXT,DLG&,Daten nachher:,0010,0120,0100,0020)
    TEXT4& =@CREATE(TEXT,DLG&,,0115,0040,0150,0020)
    EDIT1& =@CREATE(EDIT,DLG&,,0115,0070,0150,0020)
    TEXT5& =@CREATE(TEXT,DLG&,,0115,0120,0150,0020)
    TEXT8& =@CREATE(TEXT,DLG&,,0010,0125,0150,0020)
    text6& =@CREATE(TEXT,DLG&,1. mit Reg-Code;2. mit 12345,0115,0090,0150,0020)
    BUTTON3& =@CREATE(BUTTON,DLG&,>,0110,0010,0020,0024)
    BUTTON1& =@CREATE(BUTTON,DLG&,OK,0010,0150,0070,0024)
    BUTTON2& =@CREATE(BUTTON,DLG&,Abbruch,0100,0150,0070,0024)
    SETFOCUS(edit1&)
    LET DIALOGENDE%=0

    WHILENOT DIALOGENDE%

        WAITINPUT

        If @EQU(%KEY,2)

            LET DIALOGENDE%= 1

        ELSEIF clicked(BUTTON1&)BUTTON

            if trim$(gettext$(edit1&))=

                setfocus(edit1&)

            else

                dbopen(#1,datei$)
                dbgo(|<)

                whilenot %dbeof

                    clear feld$[]
                    PASSWORD trim$(gettext$(edit1&))
                    feld$[1]=pwd$(trim$(dbget$(ARTIKEL)))
                    --- debug-code -------

                    whileloop len(feld$[1])

                        print format$(#0,ord(mid$(feld$[1],&loop,1)));,;

                    endwhile

                    print  len=,format$(#0,len(feld$[1]))
                    feld$[1] = trim$(feld$[1])

                    whileloop len(feld$[1])

                        print format$(#0,ord(mid$(feld$[1],&loop,1)));,;

                    endwhile

                    print  len=,format$(#0,len(feld$[1]))
                    --- debug-code ENDE-------
                    feld$[2]=pwd$(trim$(dbget$(GRUPPE)))
                    feld$[3]=pwd$(trim$(dbget$(KCAL)))
                    feld$[4]=pwd$(trim$(dbget$(PORTION)))
                    dbput(ARTIKEL,feld$[1])
                    dbput(GRUPPE,feld$[2])
                    dbput(KCAL,feld$[3])
                    dbput(PORTION,feld$[4])
                    dbputrec(0)
                    dbgo(>)

                wend

                dbclose(#1)
                sleep 500
                dbopen(#1,datei$)
                dbgo(5)
                settext text5&,trim$(dbget$(ARTIKEL))
                dbclose(#1)
                settext edit1&,

            endif

        ELSEIF clicked(BUTTON3&)BUTTON

            datei$=LoadFile$(Umschlüsseln von:,Test*.dbf)

            if datei$=test.dbf

                dbopen(#1,datei$)
                db(go,|<)

                whilenot &dbRecNo=6

                    db(appendblank)
                    dbput(ARTIKEL,Name)
                    dbput(GRUPPE,Gruppe)
                    dbput(KCAL,500)
                    dbput(PORTION,100)
                    dbputrec(0)

                endwhile

                dbgo(5)

            else

                dbopen(#1,datei$)
                dbgo(5)

            endif

            settext text4&,trim$(dbget$(ARTIKEL))
            dbclose(#1)

        ELSEIF clicked(BUTTON2&)BUTTON

            LET DIALOGENDE%= 1

        ENDIF

    WEND

    @DESTROYWINDOW(DLG&)

endproc

cls RGB(23,23,23)
traceon
showmax
let schrift%=create(font,Comic sans MS,16,0,0,0,0)
SETDIALOGFONT schrift%
datei$=test.dbf
rueckschluesseln
end

Best wishes
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
07/27/07  
 




Dirk
Kuntzmann
Hello Michael,

many Thanks for your speedy response. on The Trim-function I had not virtual. remaining The question whether the so correctly. and pseudo is or whether it itself hierbei circa a small Error deals. i'm namely solid the opinion, that this part former functions has.

with the safety the Passwörter have you got naturally right, are usually too longer, I have now only short chosen, around the trouble To explain. Z. B. abc cut whom first letters at Entschlüsseln ex, during cba functions. A0E96519 against can itself not at all More decode. there The Passwörter but from each computer differently together staid go have I none Einfluss hereon which character or which number where in the Password auftaucht.

there's accordingly presumably only two Opportunities: 1. I were on a trim-function The nothing wegschneidet or I try the program so To change, that with all Password-functions The Trim-function not used and differently realized becomes. The first Solution find I but explicit angenehmer.

Greeting Dirk
 
07/27/07  
 




Dieter
Zornow
Versuchs time with the Api StrTrim, i think The ought to functions
CompileMarkSeparation
Def StrTrim(2) !SHLWAPI,StrTrimA

Proc ATrim

    parameters besearch$,Char$
    declare besearch#,result$
    Dim besearch#,len(besearch$)+1
    string besearch#,0 = besearch$
    StrTrim(besearch#,addr(char$))
    result$ = string$(besearch#,0)
    dispose besearch#
    return result$

endproc

cls
print ATrim(  Test.exe  , )
Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2
07/27/07  
 




Dirk
Kuntzmann
Hello Dieter,

Vielen Thanks, of Apis have I unfortunately no idea, but the what You there gezaubert has schein super To functions. remaining The question, whether The Profan Own trim-function now a Error has or whether itself behind it one sense hide.

Greeting Dirk
 
07/27/07  
 




Dirk
Kuntzmann
P.s. During one The normal Trim-function from the speed since hardly wahrnimmt, is the Api-Variant very slow (with only concise 600 Datensätzen has to the feeling, that the computer stand stayed is).

Greeting Dirk
 
07/27/07  
 




Jörg
Sellmeyer
You can whom area global deklarieren and dimensionieren. therefore becomes The procedure probably something faster:
CompileMarkSeparation
Def StrTrim(2) !SHLWAPI,StrTrimA
Declare besearch#
Dim besearch#,24MaximaleZuErwartendeStringlänge%

Proc ATrim

    parameters besearch$,Char$
    string besearch#,0 = besearch$
    StrTrim(besearch#,addr(char$))
    return string$(besearch#,0)

endproc

Print ATrim( test, )
nput
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
07/27/07  
 



10.000 derartige Operationen need by me 750ms

To testing over
CompileMarkSeparation
 {$cleq}
Def StrTrim(2) !SHLWAPI,StrTrimA
Declare besearch#
Dim besearch#,24MaximaleZuErwartendeStringlänge%

Proc ATrim

    parameters besearch$,Char$
    string besearch#,0 = besearch$
    StrTrim(besearch#,addr(char$))
    return string$(besearch#,0)

endproc

var l&=&gettickcount

whileloop 10000

    ATrim( test, )

wend

print &gettickcount-l&
WaitInput
CompileMarkSeparation and ought to imho too klappen, because your need not at all over again memory reservieren if your but already sufficient memory have. (because Trim becomes whom String hardly enhance)  
 
07/27/07  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.868 Views

Untitledvor 0 min.
Walter03/08/16
funkheld05/25/12
Andreas Koch12/16/11

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie