CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 04:13:37 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=d91ed7e49435b055edad2a4ec3e67d5f89cdbeaa0f7bdddd9d1af7f8334e1324a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22v8aqflA4Y8QeUSSw94hPcyRAnnUR4SLo%22%3B%7D; HttpOnly; Path=/
cf-ray: 98cb86a5ca4cc195-BLR
(ns lab3.core (:require [clojure.string :as str]))(def text "С милым - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns lab3.core
- (:require
- [clojure.string :as str]))
- (def text "С милым рай и в шалаше")
- (defn padding [coll n sym right?]
- (if right?
- (concat coll (repeat (- n (count coll)) sym))
- (concat (repeat (- n (count coll)) sym) coll)))
- (defn split-text [text]
- (map #(padding % 2 \space true) (partition-all 2 (seq text))))
- (defn char->bin [ch n]
- (padding (seq (Integer/toString (int ch) 2)) n \0 false))
- (defn bin->char [s]
- (char (Integer/parseInt (apply str s) 2)))
- (defn make-block [k [ch1 ch2]]
- {:k k
- :l (char->bin ch1 16)
- :r (char->bin ch2 16)})
- (defn bit-shift-r [s n]
- (if (zero? n) s (recur (conj (drop-last s) (last s)) (dec n))))
- (defn xor [s1 s2]
- (map #(if (= %1 %2) \0 \1) s1 s2))
- (defn new-key [k]
- k)
- (defn code-block [f {:keys [k l r]}]
- {:k (new-key k) :l (xor (f l k) r) :r l})
- (defn code-last [f {:keys [k l r]}]
- {:k (new-key k) :l l :r (xor (f l k) r)})
- (defn blocks->text [blocks]
- (apply
- str
- (map (fn [{:keys [_ l r]}]
- (str (bin->char l) (bin->char r)))
- blocks)))
- (defn swap-last [{:keys [k l r]}]
- {:k k :l r :r l})
- (defn encode [text n f k]
- (loop [n n
- blocks (map (partial make-block k) (split-text text))
- ks (map (fn [_] (list k)) blocks)]
- (if (zero? n)
- [blocks ks]
- (let [round-res (if (= n 1)
- (map (partial code-last f) blocks)
- (map (partial code-block f) blocks))
- new-ks (map :k round-res)]
- (recur
- (dec n)
- round-res
- (map #(conj %1 %2) ks new-ks))))))
- (defn decode [f [blocks ks]]
- (loop [n (dec (count (first ks)))
- blocks blocks
- ks (map reverse ks)]
- (if (zero? n)
- (blocks->text (map swap-last blocks))
- (recur
- (dec n)
- (map (partial code-block f) blocks)
- (map rest ks)))))
- (def t1 (encode text 16 bit-shift-r 4))
- (println (blocks->text (first t1)))
- (def t2 (decode bit-shift-r t1))
- (println t2)
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐⭐Exchange Exploit⭐⭐ 3
JavaScript | 10 sec ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ X
JavaScript | 11 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ⭐⭐ D
JavaScript | 21 sec ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ W
JavaScript | 22 sec ago | 0.24 KB
-
⭐✅ Swapzone Glitch ✅ Working⭐⭐⭐ V
JavaScript | 34 sec ago | 0.24 KB
-
⭐✅ MAKE $2500 IN 15 MIN⭐⭐⭐ G
JavaScript | 35 sec ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ B
JavaScript | 46 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ 5
JavaScript | 47 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand