Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zdimension committed Sep 19, 2015
2 parents e23134a + c903854 commit ad6ab22
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
25 changes: 25 additions & 0 deletions examples/HashCrack.has
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Imports the Math module. Allows you to use the Math class
use Math;

func main () {
# Array that holds all possible values
dict = ["computer", "laptop"];

# The hashed password to crack
passwd = "312f91285e048e09bb4aefef23627994";

# The algo that we are trying to break
algo = "md5";

# Sort through the dictionary and determine if the hash matches
for (x = 0; x < dict.length; x++) {
line = dict[Convert.toNumber(Convert.toString(x))];

if (Math.hash(algo, line) == passwd) {
println("The password is: " + line);
exit(0);
}
}

println("The hash could not be found in the dictionary.");
}
8 changes: 4 additions & 4 deletions src/Hassium/Interpreter/Interpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -976,10 +976,10 @@ public object Accept(MentalNode node)
switch (mnode.OpType)
{
case "++":
SetVariable(mnode.Name, Convert.ToDouble((object)GetVariable(mnode.Name, mnode)) + 1, mnode);
SetVariable(mnode.Name, Convert.ToInt32((object)GetVariable(mnode.Name, mnode)) + 1, mnode);
break;
case "--":
SetVariable(mnode.Name, Convert.ToDouble((object)GetVariable(mnode.Name, mnode)) - 1, mnode);
SetVariable(mnode.Name, Convert.ToInt32((object)GetVariable(mnode.Name, mnode)) - 1, mnode);
break;
default:
throw new ParseException("Unknown operation " + mnode.OpType, mnode);
Expand Down Expand Up @@ -1074,7 +1074,7 @@ public object Accept(UseNode node)
string mname = node.Path.ToLower();
if (HassiumInterpreter.options.Secure)
{
var forbidden = new List<string> {"io", "net", "network"};
var forbidden = new List<string> {"io", "net", "network", "drawing"};
if (forbidden.Contains(mname))
{
throw new ParseException(
Expand Down Expand Up @@ -1236,4 +1236,4 @@ private void VisitSubnodes(AstNode node)
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/Hassium/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private static void preformSetUp(IList<string> args)
options.Golf = true;
break;
case "-s":
case "--secure":
case "--safe":
options.Secure = true;
break;
case "-r":
Expand Down
2 changes: 1 addition & 1 deletion src/Hassium/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("0.9.1")]
[assembly: AssemblyVersion("0.9.3")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
Expand Down
5 changes: 5 additions & 0 deletions src/Hassium/obj/Debug/Hassium.csproj.FilesWrittenAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
/home/jacob/Hassium/src/Hassium/obj/Debug/Hassium.exe
/home/jacob/Hassium/src/Hassium/obj/Debug/Hassium.exe.mdb
/home/jacob/Hassium/src/Hassium/bin/Debug/MySql.Data.dll
/root/Hassium/src/Hassium/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttribute.cs
/root/Hassium/src/Hassium/bin/Debug/Hassium.exe.mdb
/root/Hassium/src/Hassium/bin/Debug/Hassium.exe
/root/Hassium/src/Hassium/obj/Debug/Hassium.exe
/root/Hassium/src/Hassium/obj/Debug/Hassium.exe.mdb

0 comments on commit ad6ab22

Please sign in to comment.