LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

remove password protection

Hi David,

 

take a look at this before optimizing your code 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 31 of 42
(3,581 Views)

@davidqk wrote:
That link is broken.  But yeah.. the code is not scalable or optimized.  But it doesn't matter that the code is not optimized, because the "bottleneck" for computation is "Set Lock State" invoke node.  And it also doesn't matter that the code has stacks of loops instead of being fully scalable.  If the password is longer than 5 characters, then you're hosed anyway.  You'll never find it in a reasonable amount of time.

I don't understand your agument. A program should always be efficient, because that leads to scaleable and re-usable code that can be applied to another scenario without rewriting from scratch. In fact your creation of unneeded local variables caused more work in this case without any benefit. Why are they even there to begin with?? It would have taken significantly less code to create the letter combinations in a single loop.

 

Code posted in the forum should act as an example and should not showcase poor coding habits. Newcomers might think it is the correct way to do things.They migh even get discouraged or give up because programming seems so complicated, even for simple problems such as this.

 

 

0 Kudos
Message 32 of 42
(3,563 Views)

@altenbach wrote:
It would have taken significantly less code to create the letter combinations in a single loop.

 Just to give you an example of what I had in mind, here's fully scalabale code that generated the letter combinations. Simpler? Maybe! 😄

 

(I took out the cracking part, and just test against a given password. This is the part that can be simplified. Sure, the conditional terminal was not avialable back in 7.1, but who really cares :D)

 

 

 

 

(note added: the above code is flawed, see below)

0 Kudos
Message 33 of 42
(3,549 Views)

VI password protection is already broked by stripping it out of the VI, don't include the block diagrams if your are concerned about somebody looking at them.

0 Kudos
Message 34 of 42
(3,543 Views)

@MD_John wrote:

VI password protection is already broked by stripping it out of the VI, don't include the block diagrams if your are concerned about somebody looking at them.


That's why I mostly talked about the academic discussion of generating letter combinations without jumping through flaming hoops. This can be a needed task elsewhere. Ugly code that has been posted here should be discussed.

0 Kudos
Message 35 of 42
(3,531 Views)

@GerdW wrote:

Hi David,

 

take a look at this before optimizing your code 😄


The link is broken.

0 Kudos
Message 36 of 42
(3,500 Views)

@altenbach wrote:

@davidqk wrote:
That link is broken.  But yeah.. the code is not scalable or optimized.  But it doesn't matter that the code is not optimized, because the "bottleneck" for computation is "Set Lock State" invoke node.  And it also doesn't matter that the code has stacks of loops instead of being fully scalable.  If the password is longer than 5 characters, then you're hosed anyway.  You'll never find it in a reasonable amount of time.

I don't understand your agument. A program should always be efficient, because that leads to scaleable and re-usable code that can be applied to another scenario without rewriting from scratch. In fact your creation of unneeded local variables caused more work in this case without any benefit. Why are they even there to begin with?? It would have taken significantly less code to create the letter combinations in a single loop.

 

Code posted in the forum should act as an example and should not showcase poor coding habits. Newcomers might think it is the correct way to do things.They migh even get discouraged or give up because programming seems so complicated, even for simple problems such as this.

 

 


I wasn't arguing that my code wasn't ugly.  Already knew that.  But yeah, if I was expecting my code to be re-used in multiple scenarios I would have done something different.  My code did the job for me, and because of the bottleneck of the "Set Lock State" invoke node, it doesn't run any slower than the code you posted (which is better).

0 Kudos
Message 37 of 42
(3,499 Views)

Hi david,

 

the link is ok for me...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 38 of 42
(3,466 Views)

Just a note: My code above is incorrect. It can be fixed with a few simple changes. 😉

 

Exercise: Show why it is incorrect and show how to fix it. 😄

0 Kudos
Message 39 of 42
(3,445 Views)

@altenbach wrote:

Just a note: My code above is incorrect. It can be fixed with a few simple changes. 😉

 

Exercise: Show why it is incorrect and show how to fix it. 😄


Well, nobody seems to care, so here is the fixed version. The previous version cannot find certain passwords, e.g. (aaa) because the inner while loop terminates early in these cases. Many other variations are possible, of course. Your turn!

 

 

0 Kudos
Message 40 of 42
(3,416 Views)