Sonic and Sega Retro Message Board: ArrowCase - Viewing Profile - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help

Group:
Trial Member: Trial Members
Active Posts:
3 (0.02 per day)
Most Active In:
Engineering & Reverse Engineering (2 posts)
Joined:
04-March 15
Profile Views:
364
Last Active:
User is offline Mar 06 2015 01:56 PM
Currently:
Offline

My Information

Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Not Telling Not Telling

Contact Information

E-mail:
Private

Topics I've Started

  1. Blue Sphere Password Algorithm Reverse-Engineered

    05 March 2015 - 08:16 PM

    A while ago I became interested in reverse engineering, recreating, and re-implementing the Blue Sphere minigame in a project all my own (using the art assets directly from the game, otherwise from scratch). My initial search led me to "bsgen," which as you may or may not know is a collection of javascript functions that are able to generate information about each level given the level number or "stage number" (a sort of ID algorithmically associated with each level). These functions, which were originally created by a Japanese coder under the name koryan and later modified slightly by others, have been invaluable to my project. You can find them archived here: http://bsgen-archive.neocities.org/

    There are functions to go back and forth between most relevant values: level to stage number, stage to quadrant numbers, level to password, and others. To my knowledge, however, there has been no published example of an algorithm to take a password as input and see if it corresponds to a level number. That is what I have created, made available here in javascript to fit in with the rest of koryan's functions: http://pastebin.com/cnyKdTCr

    I commented the code somewhat thoroughly; if anyone wants to know more about it, please ask. I hope anyone who, like I did, stumbles upon Sonic Retro while searching for information about Blue Sphere's algorithms, will be able to learn something from this and put it to good use!

    Why was this reversal non-trivial? Well, the javascript in these functions uses arrays of 1s and 0s to carry out what in a non-javascript (read: non-terrible) language should be simple bit operations, and these operations as well as the binary to decimal "password" conversion method used in the script are mildly confusing, and in one important case, non-reversible. Fortunately, I was able to determine that only one "half" of the bit array created in "levtocod" is needed to work backward to the level number — then, that level number can be validated by performing the latter half of levtocod's calculations and seeing if the bit pattern matches the one we got in reverse.

    Anyone looking to create versions of this algorithm in other languages should note that the password number is at one point or another treated as one giant integer, and its huge size may exceed the maximum integer value for your language. This is one advantage of javascript: its basic "number" type has a maximum integral size of about 9 trillion.

Friends

ArrowCase hasn't added any friends yet.