Author Topic: Password Protection  (Read 10170 times)

0 Members and 1 Guest are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Password Protection
« on: November 11, 2010, 11:43:33 am »
Hey everybody, some friends in my class love to delete other people's RAM and play my games, and transfer my games to their calculators -.-

So, I thought of some protection, with the Start-Up Application, it would open an Axe file everytime I turned on the calculator.

Now, I need to make a file where I have to input a password and if it is wrong, let me try again, anytimes I want to, infinitely and no keys can turn it off.

So, do something like:

Code: [Select]
.LOGCALC
A=1
While A != 5
Lbl 1
Repeat getKey->Z
End
If Z=x and Z=y and Z=..... (all keys, but 4,down key and 1)
Goto 1
End
If Z=1 //down key
A+A->A
End
If Z=34 //1 key
A+A->A
End
If Z=35 // 4key
A+1->A //A should now be 5
End

So, to turn on the calculator i have to press down key, 1 and 4key by this order.

Any suggestions?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Password Protection
« Reply #1 on: November 11, 2010, 11:58:08 am »
Did you know MirageOS has a great password system?  Merely set your password, go to the main menu, and press On to turn the calculator off.  When it is turned back on, it will prompt for a password, if it is incorrect it will turn back off ^^

But for the sake if programing, you probably want to do something like this:

Code: [Select]
Data(1,2,3,4)->Str1
0->S
Repeat S=4
0->S
ClrHome
For(F,0,3
0->K
Repeat K
getKey->K
End
{Str1+F}=K+S->S
Output(F,0,"*
End
End
Output(0,0,"Welcome!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Password Protection
« Reply #2 on: November 11, 2010, 12:00:49 pm »
^ Yep, use Data(. That way you can quickly change which keys you want, and it's a lot smaller, too.

And use Repeat getKey->K instead of 0->K:Repeat K:getKey->K.
« Last Edit: November 11, 2010, 12:01:33 pm by Deep Thought »




Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Password Protection
« Reply #3 on: November 11, 2010, 12:11:28 pm »
What I've used was Krolypto.  I don't know anybody that could get past it (except for myself, but you need a screwdriver).
If you don't want to do that, see if you have calcutil.  If you do, you can use its run program on startup function
Spoiler For how:
Create a program called PROGLIST
Type in
Code: [Select]
S:<program name here>Test it by turning off the calc, then turning it back on
If Calcutil's installed, it should work
You can make your program run on startup, archived or not, ASM or not.
« Last Edit: November 11, 2010, 12:12:58 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Password Protection
« Reply #4 on: November 11, 2010, 12:19:33 pm »
What I've used was Krolypto.  I don't know anybody that could get past it (except for myself, but you need a screwdriver).
If you don't want to do that, see if you have calcutil.  If you do, you can use its run program on startup function
Spoiler For how:
Create a program called PROGLIST
Type in
Code: [Select]
S:<program name here>Test it by turning off the calc, then turning it back on
If Calcutil's installed, it should work
You can make your program run on startup, archived or not, ASM or not.

I think he's using Startup. But yeah, most of the major shells have password support.

And nice, I didn't know CalcUtil could do that. Feature request for Kerm...




Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Password Protection
« Reply #5 on: November 11, 2010, 01:23:21 pm »
Code: [Select]
Data(1,2,3,4)->Str1
0->S
Repeat S=4
0->S
ClrHome
For(F,0,3
0->K
Repeat K
getKey->K
End
{Str1+F}=K+S->S
Output(F,0,"*
End
End
Output(0,0,"Welcome!

I don't know what Data does. What's in that code, I would have to press keys 1,2,3,4?

I don't really understand that code, comments maybe?

Thanks
_______________________________________________________________________________________________________________________

I managed to do my own one :D

The .8xp is attached you have to press down key, one key and four key to open it in that order :)

Code:

Code: [Select]
:.LOGCALC
:ClrHome
:1→A
:While A≠5
:Lbl 1
:Repeat getKey→Z
:End
:If Z=1 or Z=2 or Z=3 or Z=4 or Z=5 or Z=6 or Z=7 or Z=8 or Z=9 or Z=10 or Z=11 or Z=12 or Z=13 or Z=14 or Z=15 or Z=16 or Z=17 or Z=18 or Z=19 or Z=20 or Z=21 or Z=22 or Z=23 or Z=24 or Z=25 or Z=26 or Z=27 or Z=28 or Z=29 or Z=30 or Z=31 or Z=32 or Z=33 or Z=35 or Z=36 or Z=37 or Z=38 or Z=39 or Z=40 or Z=41 or Z=42 or Z=43 or Z=44 or Z=45 or Z=46 or Z=47 or Z=48 or Z=49 or Z=50 or Z=51 or Z=52 or Z=54
:Goto 1
:End
:If Z=1
:A+A→A
:End
:If Z=34
:A+A→A
:End
:If Z=35
:A+1→A
:End
:End
« Last Edit: November 11, 2010, 01:29:23 pm by ScoutDavid »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Password Protection
« Reply #6 on: November 11, 2010, 01:38:26 pm »
Data( just stores data. It's like a list in BASIC. Then all Builderboy's routine does is gets keys four times, each time checking to see if it matches the Nth term in the list. You should change 1, 2, 3, and 4 to the keycodes of whatever keys you want :)

It's a lot smaller than hardcoding the key checks yourself.




Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Password Protection
« Reply #7 on: November 11, 2010, 01:51:28 pm »
Data( just stores data. It's like a list in BASIC. Then all Builderboy's routine does is gets keys four times, each time checking to see if it matches the Nth term in the list. You should change 1, 2, 3, and 4 to the keycodes of whatever keys you want :)

It's a lot smaller than hardcoding the key checks yourself.

:O Got it :) Thanks much

So Data is like lists, but you can save them as Strings

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Password Protection
« Reply #8 on: November 11, 2010, 01:53:20 pm »
Yep, exactly. In Axe, the GDBs, Strs, and Pics are completely interchangeable.




Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Password Protection
« Reply #9 on: November 11, 2010, 02:05:11 pm »
Code: [Select]
:.LOGCALC
:ClrHome
:1→A
:!If A=5                                     An "!" does the same thing as ≠
:Lbl 1
:Repeat getKey→Z
:End
:! If Z=1+(Z=34)+(Z=35)       to add 'multiple choices' , use "+(-add choice here-)"
:Goto 1
:End
:If Z=1
:2*A→A
:End
:If Z=34
:2*A→A
:End
:If Z=35
:A+1→A
:End
:End


Just a little optimization to show you a few things...
« Last Edit: November 11, 2010, 02:16:27 pm by aeTIos »
I'm not a nerd but I pretend:

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Password Protection
« Reply #10 on: November 11, 2010, 10:00:09 pm »
Code: [Select]
:.LOGCALC
:ClrHome
:1→A
:!If A=5                                     An "!" does the same thing as ≠
:Lbl 1
:Repeat getKey→Z
:End
:! If Z=1+(Z=34)+(Z=35)       to add 'multiple choices' , use "+(-add choice here-)"
:Goto 1
:End
:If Z=1
:2*A→A
:End
:If Z=34
:2*A→A
:End
:If Z=35
:A+1→A
:End
:End


Just a little optimization to show you a few things...

Did somebody say optimization? ;)

Some notes about your optimizations:
  • !If A=5 is no smaller than If A≠5. However, if the if statement is only checking one not equal condition, you can use If A-5, which is smaller.
  • You were smart to use additions instead of ors for Z=1+(Z=34)+(Z=35), but the negation of the if statement (the !) would reverse what you want.
  • Like my first note, !If Z-1 is a smaller way of saying If Z=1. Remember this only works alone, you cannot usually combine something like Z-1 with other conditions.
  • It is always better to include constants as the second argument in operations. Not only is A*2 smaller than 2*A, but also it won't require the whole multiplication routine.

And now, the super-optimized version:

Code: [Select]
:.LOGCALC
:.DiagnosticOff and ClrHome are both unnecessary, but make it look better
:DiagnosticOff
:ClrHome
:Lbl S
:!If sub(G)-1
:!If sub(G)-34
:Return!If sub(G)-35
:End
:End
:Goto S
:Lbl G
:Repeat getKey
:End
« Last Edit: November 11, 2010, 10:18:03 pm by Runer112 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Password Protection
« Reply #11 on: November 12, 2010, 03:41:24 am »
Darn that shrank down quite a bit. :O

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Password Protection
« Reply #12 on: November 12, 2010, 07:52:16 am »
Quote
...And now, the super-optimized version:

Code: [Select]
:.LOGCALC
:.DiagnosticOff and ClrHome are both unnecessary, but make it look better
:DiagnosticOff
:ClrHome
:Lbl S
:!If sub(G)-1
:!If sub(G)-34
:Return!If sub(G)-35
:End
:End
:Goto S
:Lbl G
:Repeat getKey
:End

WOW :)

BTW, is it possible to un-assemble an assembled file into ASM so you can open it and edit?
« Last Edit: November 12, 2010, 07:53:42 am by aeTIos »
I'm not a nerd but I pretend:

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Password Protection
« Reply #13 on: November 12, 2010, 01:06:14 pm »
Quote
...And now, the super-optimized version:

Code: [Select]
:.LOGCALC
:.DiagnosticOff and ClrHome are both unnecessary, but make it look better
:DiagnosticOff
:ClrHome
:Lbl S
:!If sub(G)-1
:!If sub(G)-34
:Return!If sub(G)-35
:End
:End
:Goto S
:Lbl G
:Repeat getKey
:End

WOW :)

BTW, is it possible to un-assemble an assembled file into ASM so you can open it and edit?


Here: http://www.ticalc.org/archives/files/fileinfo/162/16219.html

It occasionally doesn't work, for some reason...




Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Password Protection
« Reply #14 on: November 12, 2010, 01:10:34 pm »
thanx
I'm not a nerd but I pretend: