A music player that connects to your cloud/distributed storage.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add crypto stuff

+163 -6
+8
Makefile
··· 49 49 @make -j watch-wo-build server 50 50 51 51 52 + doc-tests: 53 + @echo "> Running documentation tests" 54 + @( cd src && \ 55 + find . -name "*.elm" -print0 | \ 56 + xargs -0 -n 1 sh -c 'elm-proofread -- $0 || exit 255; echo "\n\n"' 57 + ) 58 + 59 + 52 60 server: 53 61 @echo "> Booting up web server on port 5000" 54 62 @devd --port 5000 --all --crossdomain --quiet --notfound=index.html $(BUILD_DIR)
+13 -6
elm.json
··· 11 11 "avh4/elm-color": "1.0.0", 12 12 "danmarcab/material-icons": "1.0.0", 13 13 "elm/browser": "1.0.1", 14 - "elm/core": "1.0.0", 14 + "elm/core": "1.0.2", 15 15 "elm/html": "1.0.0", 16 - "elm/http": "1.0.0", 17 - "elm/json": "1.0.0", 16 + "elm/http": "2.0.0", 17 + "elm/json": "1.1.2", 18 18 "elm/svg": "1.0.1", 19 19 "elm/time": "1.0.0", 20 20 "elm/url": "1.0.0", 21 21 "elm-community/list-extra": "8.1.0", 22 + "icidasset/elm-binary": "1.3.0", 23 + "icidasset/elm-sha": "1.0.0", 22 24 "jorgengranseth/elm-string-format": "1.0.1", 23 - "justgage/tachyons-elm": "4.1.0" 25 + "justgage/tachyons-elm": "4.1.1", 26 + "rtfeldman/elm-hex": "1.0.0" 24 27 }, 25 28 "indirect": { 29 + "elm/bytes": "1.0.7", 30 + "elm/file": "1.0.1", 26 31 "elm/regex": "1.0.0", 27 32 "elm/virtual-dom": "1.0.2" 28 33 } 29 34 }, 30 35 "test-dependencies": { 31 36 "direct": {}, 32 - "indirect": {} 37 + "indirect": { 38 + "elm/random": "1.0.0" 39 + } 33 40 } 34 - } 41 + }
+58
src/Library/Crypto/Binary.elm
··· 1 + module Crypto.Binary exposing (empty, fromString, toString) 2 + 3 + import Binary exposing (Bits) 4 + 5 + 6 + {-| Convert a string to binary. 7 + Uses the UTF-8 text-encoding. 8 + 9 + >>> import Binary 10 + 11 + >>> "🤶" 12 + ..> |> fromString 13 + ..> |> Binary.toHex 14 + "1F936" 15 + 16 + >>> "abc" 17 + ..> |> fromString 18 + ..> |> Binary.toHex 19 + "616263" 20 + 21 + -} 22 + fromString : String -> Bits 23 + fromString string = 24 + string 25 + |> String.toList 26 + |> List.map (Char.toCode >> Binary.fromDecimal >> Binary.ensureBits 8) 27 + |> Binary.concat 28 + 29 + 30 + {-| Convert bits to a string. 31 + Uses the UTF-8 text-encoding. 32 + 33 + >>> import Binary 34 + 35 + >>> "1F936" 36 + ..> |> Binary.fromHex 37 + ..> |> toString 38 + "🤶" 39 + 40 + >>> "616263" 41 + ..> |> Binary.fromHex 42 + ..> |> toString 43 + "abc" 44 + 45 + -} 46 + toString : Bits -> String 47 + toString bits = 48 + bits 49 + |> Binary.chunksOf 8 50 + |> List.map (Binary.toDecimal >> Char.fromCode) 51 + |> String.fromList 52 + 53 + 54 + {-| Empty binary sequence. 55 + -} 56 + empty : Bits 57 + empty = 58 + Binary.fromBooleans []
+84
src/Library/Crypto/Hmac.elm
··· 1 + module Crypto.Hmac exposing (encrypt128, encrypt64) 2 + 3 + {-| Cryptography – HMAC 4 + -} 5 + 6 + import Binary exposing (Bits) 7 + import Crypto.Binary as Binary 8 + import SHA 9 + 10 + 11 + type alias HashFunction = 12 + String -> Bits 13 + 14 + 15 + {-| HMAC encryption for hashing algorithms with a `blockSize` of 64. 16 + These include: SHA-0, SHA-1, SHA-224, SHA-256, MD5, etc. 17 + 18 + >>> import Binary 19 + >>> import SHA 20 + 21 + >>> encrypt64 SHA.sha256 "" "" 22 + ..> |> Binary.toHex 23 + ..> |> String.toLower 24 + "b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad" 25 + 26 + >>> encrypt64 SHA.sha256 "The quick brown fox jumps over the lazy dog" "key" 27 + ..> |> Binary.toHex 28 + ..> |> String.toLower 29 + "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8" 30 + 31 + -} 32 + encrypt64 : HashFunction -> String -> String -> Bits 33 + encrypt64 = 34 + encrypt 64 35 + 36 + 37 + {-| HMAC encryption for hashing algorithms with a `blockSize` of 128. 38 + These include: SHA-384, SHA-512, etc. 39 + -} 40 + encrypt128 : HashFunction -> String -> String -> Bits 41 + encrypt128 = 42 + encrypt 128 43 + 44 + 45 + 46 + -- ENCRYPT 47 + 48 + 49 + encrypt : Int -> HashFunction -> String -> String -> Bits 50 + encrypt blockSize hash message key = 51 + let 52 + keySize = 53 + String.length key 54 + 55 + keyWithBlockSize = 56 + if keySize > blockSize then 57 + hash key 58 + 59 + else if keySize < blockSize then 60 + Binary.fromString <| String.padRight blockSize (Char.fromCode 0) key 61 + 62 + else 63 + Binary.fromString <| key 64 + 65 + ( binSeqOne, binSeqTwo ) = 66 + keyWithBlockSize 67 + |> Binary.chunksOf 8 68 + |> List.map 69 + (\k -> 70 + ( Binary.xor k (Binary.fromDecimal 0x36) 71 + , Binary.xor k (Binary.fromDecimal 0x5C) 72 + ) 73 + ) 74 + |> List.unzip 75 + |> Tuple.mapBoth Binary.concat Binary.concat 76 + in 77 + message 78 + |> Binary.fromString 79 + |> Binary.append binSeqOne 80 + |> Binary.toString 81 + |> hash 82 + |> Binary.append binSeqTwo 83 + |> Binary.toString 84 + |> hash