How make secret codes?

Hello,

I am trying to share a game with my friends where they can use codes to unlock certain items, however I am worried that they will be able to discover all the codes just by looking at the source code. (I'm planning to place qr codes all over town and make them look for them.)

I know the whole point of the website is to allow everyone to share their code with each other but I am just trying to conceal specific passwords so the game cannot be cheated.

Is there any way I can achieve that?

Thanks a lot in advance!

There's not really an easy way to do it. There's not really anything you can do about someone cheating, even if they don't find the secret codes. They could just change the values of variables.

You can use a hash function like sha-3, (or an older one, it doesn't actually need to be cryptographically secure) but you would have to implement it yourself. Someone who reads the source could still bypass the check, but cannot retrieve the code.

@ego-lay_atman-bay @spaceelephant You can remove the ui using URL tags:

https://snap.berkeley.edu/snap/snap.html#present:Username=joecooldoo&ProjectName=MultiOS&hideControls

And someone who views the project can remove the flag. That may be a good idea for this project just to make it look cleaner, but it isn't security. There is not, and should not be, any way to hide the actual code. Even in compiled languages, it is just a lack of debug symbols. If you want to, you can randomize all your block names, but it isn't compiled, so it would still be readable enough: as it should be.

you can't make it impossible for them to figure out (the computer still needs to be able to do it with your instructions) but you can make it difficult

if i understand correctly the only thing you're trying to hide is qr codes, so what i would do is make a large image with random black and white pixels, and in certain places put the contents of the qr codes in the image (remove the 4 square markers! they should be replaced with more random pixels)

after that what you can do is keep track of the locations of where the qr codes are in the project, then use the pen to cut out the relevant section and put the markers back on it

of course, if you really need to hide it you should come up with more of your own tricks too, it's not much of a secret if everyone that reads this knows how it works (it's also pretty fun to try and figure out how you can hide things well)

I don't really have an answer for this. My answer is kind of stupid and there are tons more better answers than mine.

I suggest that you switch to a different coding environment entirely and use some Game Engine.

Then do it in an iframe and host it on a website

This Frame → Show only this frame

?
Sorry im not as good at html as my brother,

It's not an HTML thing, it is a browser thing that lets you see the iframe directly, and then you can edit the URL.

ok, ill work on it

<iframe src="https://snap.berkeley.edu/snap/snap.html#present:Username=joecooldoo&ProjectName=MultiOS&hideControls" width="525" height="500">

Or, if you want the full HTML page,

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<iframe src="https://snap.berkeley.edu/snap/snap.html#present:Username=joecooldoo&ProjectName=MultiOS&hideControls" width="525" height="500">
</body>
</html>

https://Multi-OS.joecooldoo.repl.co

Fullscreen iframe using CSS:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Multi OS</title>
</head>
<body>
  <!--https://www.geeksforgeeks.org/how-to-set-fullscreen-iframe/-->
  <style>
    html {
      overflow: auto;
    }
    html,
    body,
    div,
    iframe {
      margin: 0px;
      padding: 0px;
      height: 100%;
      border: none;
    }
    iframe {
      display: block;
      width: 100%;
      border: none;
      overflow-y: auto;
      overflow-x: hidden;
    }
  </style>
  <iframe src="https://snap.berkeley.edu/snap/snap.html#present:Username=joecooldoo&ProjectName=MultiOS&hideControls"
    width="100%" height="100%">
</body>
</html>

@spaceelephant You can't change the URL to a different page without it being obvious that you did change it.

ok nice

Wow I didn't even know this was possible. I am going to try this out. Are there any other URL tags to use?

there is also &noRun as well as &editMode

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.