summaryrefslogtreecommitdiff
path: root/src/main/scala/com/nsrddyn/cpu/ALU/Hash.scala
diff options
context:
space:
mode:
authorAbdellah El Morabit <nsrddyn@gmail.com>2025-11-19 00:58:59 +0100
committerAbdellah El Morabit <nsrddyn@gmail.com>2025-11-19 00:58:59 +0100
commitb3a5e3305a7f479aea0851a07e95b80088dd45e4 (patch)
treed43efaac00160630c51c9ad4690027ae8313fe63 /src/main/scala/com/nsrddyn/cpu/ALU/Hash.scala
parent94e2465ded436006cdd3f57dc6d4e3f733c28733 (diff)
feature: implemented hashing loop
- cleaned up useless ALU.scala file - will not be passing threads as parameters
Diffstat (limited to 'src/main/scala/com/nsrddyn/cpu/ALU/Hash.scala')
-rw-r--r--src/main/scala/com/nsrddyn/cpu/ALU/Hash.scala26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/main/scala/com/nsrddyn/cpu/ALU/Hash.scala b/src/main/scala/com/nsrddyn/cpu/ALU/Hash.scala
index 7a198f7..8cd39c3 100644
--- a/src/main/scala/com/nsrddyn/cpu/ALU/Hash.scala
+++ b/src/main/scala/com/nsrddyn/cpu/ALU/Hash.scala
@@ -3,11 +3,29 @@ package com.nsrddyn
import scala.util.hashing
class Hash {
-
- def hashString(): Unit = {
-
- println("Hello from hash function")
+import scala.util.hashing.MurmurHash3
+
+ def run(word: String, loopSize: Int): Unit = {
+
+ /* TODO: implement ALU friendly, so high speed hashing
+ * to continuously loop over voor stressing
+ * ALU
+ *
+ * While looking for hashing algorithmes to implement I stumbled on:
+ * https://scala-lang.org/api/3.x/scala/util/hashing/MurmurHash3$.html
+ *
+ * which is an implemntation of **smasher** http://github.com/aappleby/smhasher
+ * the exact type of hashing algorithm I was looking for
+ *
+ * In the scala description they state: "This algorithm is designed to generate
+ * well-distributed non-cryptographic hashes. It is designed to hash data in 32 bit chunks (ints). "
+ *
+ * (ints) -> ALU
+ *
+ */
+
+ for i <- 0 to loopSize do MurmurHash3.stringHash(word)
}
}