03-19-2013 12:58 PM
03-19-2013 02:04 PM
@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.
03-19-2013 03:24 PM - edited 03-21-2013 06:58 PM
@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)
03-19-2013 03:33 PM
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.
03-19-2013 03:41 PM
@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.
03-19-2013 11:36 PM
03-19-2013 11:40 PM - edited 03-19-2013 11:41 PM
@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).
03-21-2013 03:02 AM
03-21-2013 06:27 PM
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. 😄
03-22-2013 01:50 PM - edited 03-22-2013 01:50 PM
@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!