Jump to content


Dave-ee Jones

Member Since 19 Jan 2013
Offline Last Active Jul 19 2018 05:51 AM
-----

Topics I've Started

Creating an "obscurer" (cryptologic)

27 April 2018 - 04:22 AM

Hoi!

Been a while, but I'm playing around with creating a hashing algorithm. Basically all it's doing is obscuring the string (like every other hashing algorithm), but in a way that's still predictable in a sense that you could spend a few hours creating a reversing algorithm.

Are there any tips from the nerds themselves regarding the below code? Any immediate issues that need to be looked at? Any quick ways of reverting the code? The code isn't meant to be reversible, it's just meant to be a hashing algorithm so that you can compare strings.

Basically what my code is doing is grabbing a "dex", which is a table of 20 4-digit numbers (the numbers could be 1-digit, 2-digit, 3-digit etc. etc.) but it's kinda like an SSL certificate. If one user hashes a string with a dex, another user needs to use the same dex to get the same hash (or even decrypt the hash).

To be honest, as I'm typing this I'm understanding it way clearer, haha! But still, tips and suggestions would be good!

The only issue I can find with the dex is that anyone can grab a dex from a computer, so the dex itself isn't secure but the hash is secure if the dex is, if you get what I mean.

A link to the Github paste is below. It's only 45 lines, so no biggy. And I made it so the strings are "easily" understandable.

Thanks!

Github Link


Program usage: hashtest <path-to-dex> <string>


Example of a dex (copy-paste to a text file to test the program if you want):
{
  "6854",
  "2422",
  "5194",
  "9359",
  "3920",
  "6207",
  "9857",
  "1821",
  "0315",
  "0681",
  "3310",
  "2616",
  "5582",
  "3201",
  "7485",
  "8669",
  "9176",
  "1625",
  "0670",
  "5816"
}

If you change a number in one of the indexes in the table you'll notice not that much changes in the hash intervals. Ideally I'd like it to change the hash completely but y'know, that could mean a couple hundred more lines of code.

Shark - A site browser for CC

01 November 2017 - 04:45 AM

Shark
By Dave-ee Jones



What's Shark?
Shark is a web browser made for CC.
It uses similar methods to a normal browser, however there are a few differences.

Shark Language
No, I will not pretend to be a shark-talking version of Dory.

Shark has it's own language for pages. When you access an external site all the pages will be written in SL. A file that contains SL is called an 'SLS', or Shark Language Sheet. A line of SL is called a 'SLL', or Shark Language Line. Shark Language is quite similar to HTML and (fairly) easy to write and understand.

Shark Language is executed line by line, just like Lua.

Sharkles
URLs are replaced with Sharkles. Sharkles look similar to URLs but their format is a little different. Here's an example of a Sharkle:
local://home/

You may notice that instead of 'http://' it has 'local://'. This part of the Sharkle is known as the 'hostname' (or, more simply, 'id' or 'host'). It tells Shark where to look for the page you are looking for.
'local' and 'localhost' tell Shark to look for pages on your local machine.

External Sites
You can also tell Shark to use a computer ID instead. For example:
2://example/

The above code tells Shark to ask the computer that has the ID 2 for the index page of the site 'example'. Sounds like a mouthful, but it's actually very simple.

Shark also uses a variation of host resolving, and it does so with a file that contains a table. This file is known as the HRF, or Host Resolution File. In this file you can specify what hostnames should go to what computer ID. Here's an example:
{
["jack"] = 2,
["boss"] = 0,
["house"] = 1
}

Using the above table, if I type the following into the Sharkle, Shark can convert this to a computer ID so it can talk to the computer and grab details of the site, like so:
house://example/
--# CONVERTS TO
1://example/

Error Handling
Shark has it's own error codes to deal with Sharkle errors. If it can't find a site, page or host it will let you know by taking you to the error page with relevant information.

It also logs all errors - even if it crashes Shark.

Sites
You can create your own sites, using Shark's own language. Refer to the wiki for more information.

History
Everytime you visit a site it is logged to the history file with the local MC time (useful, I know).





Download and Install


For downloads, look to the Github!


Install instructions are incredibly simple and can be found in the README in the VERSION 1 folder.



MORE INFORMATION AND DETAILS CAN BE FOUND ON THE SHARK GITHUB.


load() file in current environment?

24 October 2017 - 09:52 PM

Hoi!

This question might seem really complicated in the title, but it's not. Sorry, I couldn't find the words to describe this problem.

So, I've got a file that needs to be run in another file's context. E.g.

File 1 declares this variable and loads File 2's contents and runs them.
local LOCALS = {}
local file2 = loadfile(file2)
file2()

File 2 references an index in that variable:
if LOCALS["test"] == "this is a test" then
  print("True!")
else
  print("False!")
end

But it just comes up with this error:
string:1: attempt to index ? (a nil value)

Obviously because it doesn't recognise the 'LOCALS' table. I don't want to make everything global, so how can I run File2 as if it was part of File1's code (without putting that code in File1) so that it does recognise File1's variables?

I would assume this has been answered before because it seems like a pretty obvious question in some cases..Unless not?

Anyway, any help would be appreciated! :)

Deleting whitespace at start of string but not at end

13 October 2017 - 05:21 AM

Hoi!

So, I've got my programming language parser working pretty mint but then realised that it's removing the whitespace on the end of a line. So if I've got a snippet that looks like this:
<color[red,white]>
<write>
  hey!
  what's up?
</write>
</color>

And I have a space write after 'hey!' on the same line (e.g. 'hey! ') then it will remove the space after 'hey!', which is what I don't want because I want 'what's up?' to appear a space after 'hey!', if you catch my drift.

Here's my current whitespace-removing-technique:
_line:match("^%s*(.-)%s*$")

It removes the whitespace line-by-line.

Any help is appreciated. I'm assuming it's just an alteration to the current 'string:match(..)' I have, but since I'm not familiar with the character codes I cannot figure it out myself (maybe remove '(.-)%s*$' at the end?).

The Progress of Shark (and co.)

06 October 2017 - 12:46 AM

Hoi!

I'm working on a programming language for a browser I'm making. It's...interesting...made more of parsing than anything else, really. Very hard, but almost..captivating.

The language will seem quite familiar with a bit of a twist for better argument handling (well, for Lua anyway).
Here's a quick example:
<color['blue','lightBlue']>
  <print['3','3']>
	OI, RED!
	<color['red','orange']>
	   WHAT?
	</color>
	Oh, nothing.
  </print>
</color>
Guess what's it's based off :P
The arguments for 'color' is pretty self explanatory, but the 'print' command's arguments are the starting X and Y position of the text. Also, the text has a CONTINUING X position, but obviously not Y otherwise it would overwrite the old text in that same spot (if you were to have multiple lines).

It's pretty cool, could be really powerful for UI creation (having <button>, <checkbox> etc.). Things like <center> or <column> may be a bit harder, though, but it's definitely worth a shot.

It's currently working quite well. My parsing program (called 'Shark' at the moment) runs that snippet of code up there, outputting this:

Quote

OI, RED! (pretend there's a light blue background on this text)
WHAT? (pretend there's an orange background on this text)
Oh, nothing. (pretend there's a light blue background on this text)
Notice how you can have tags inside <print>'s and <write>'s.

The main reason I'm creating this 'Shark Language' (.sls files - standing for Shark Language Sheet) is for a browser I'm working on (similar to Thunderbird/Firewolf but obviously not as great). It'll be used for websites/pages.

Anyway, just felt like sharing what I'm working on and how it's going, because it's my first time creating a language parsing program and it's pretty exciting. :D