[Solved] unable out figure out error in below program [closed]

This is a case of undefined behavior: if(!visited[j]) is undefined. visited is not initialized because the call memset(visited, sizeof(visited), false); is wrong. You are reading uninitialized variables. The declaration of memset is void *memset( void *dest, int ch, size_t count ); You are writting 0 times the value 10000 into visited. On your machine this … Read more

[Solved] algorithm for slicing brute force keyspace [closed]

Let’s start with a slightly simpler problem. All keys are 8 numeric digits, and you have 10 machines. Simple enough – one machine checks 0???????, another checks 1??????? and so on. Note that this slicing doesn’t care that you’re doing multiprocessing – it’s just allocating ranges by fixing one of the digits. Your version is … Read more

[Solved] Using Brute Force to generate all possible combination of binary numbers as array? [closed]

First of all, you need to provide a minimal reproducible example of your code. You can check here: https://stackoverflow.com/help/minimal-reproducible-example In regards to your question, using three loops can be a solution: import java.util.ArrayList; public class Main { public static void main(String[] args) { var combinations = new ArrayList<int[]>(); for (int i = 0; i < … Read more

[Solved] Ceaser Cipher crack using C language

Recall that a Caesar Cipher has only 25 possible shifts. Also, for text of non-trivial length, it’s highly likely that only one shift will make the input make sense. One possible approach, then, is to see if the result of the shift makes sense; if it does, then it’s probably the correct shift (e.g. compare … Read more

[Solved] Print all possible combinations, given a specific number format [closed]

Try this: with open(‘file.out’, ‘w’) as output: for n in xrange(100000000): s = “{0:08d}”.format(n) output.write(s[:2] + ‘-‘ + s[2:] + ‘\n’) … But be aware that that’s a lot of combinations, it’s possible that you’ll run out of memory, and if not anyway the resulting file will be huge and the program will take a … Read more