Skip to content

Commit 031bd9b

Browse files
committed
Added JS + PY + Swift
1 parent 08de365 commit 031bd9b

11 files changed

+272
-3
lines changed

.gitignore

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
# Created by https://www.gitignore.io/api/node,macos
3+
4+
### macOS ###
5+
*.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
9+
# Icon must end with two \r
10+
Icon
11+
12+
# Thumbnails
13+
._*
14+
15+
# Files that might appear in the root of a volume
16+
.DocumentRevisions-V100
17+
.fseventsd
18+
.Spotlight-V100
19+
.TemporaryItems
20+
.Trashes
21+
.VolumeIcon.icns
22+
.com.apple.timemachine.donotpresent
23+
24+
# Directories potentially created on remote AFP share
25+
.AppleDB
26+
.AppleDesktop
27+
Network Trash Folder
28+
Temporary Items
29+
.apdisk
30+
31+
### Node ###
32+
# Logs
33+
logs
34+
*.log
35+
npm-debug.log*
36+
yarn-debug.log*
37+
yarn-error.log*
38+
39+
# Runtime data
40+
pids
41+
*.pid
42+
*.seed
43+
*.pid.lock
44+
45+
# Directory for instrumented libs generated by jscoverage/JSCover
46+
lib-cov
47+
48+
# Coverage directory used by tools like istanbul
49+
coverage
50+
51+
# nyc test coverage
52+
.nyc_output
53+
54+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
55+
.grunt
56+
57+
# Bower dependency directory (https://bower.io/)
58+
bower_components
59+
60+
# node-waf configuration
61+
.lock-wscript
62+
63+
# Compiled binary addons (http://nodejs.org/api/addons.html)
64+
build/Release
65+
66+
# Dependency directories
67+
node_modules/
68+
jspm_packages/
69+
70+
# Typescript v1 declaration files
71+
typings/
72+
73+
# Optional npm cache directory
74+
.npm
75+
76+
# Optional eslint cache
77+
.eslintcache
78+
79+
# Optional REPL history
80+
.node_repl_history
81+
82+
# Output of 'npm pack'
83+
*.tgz
84+
85+
# Yarn Integrity file
86+
.yarn-integrity
87+
88+
# dotenv environment variables file
89+
.env
90+
91+
92+
93+
# End of https://www.gitignore.io/api/node,macos

.travis.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
dist: trusty
2+
sudo: required
3+
env:
4+
- SWIFT_VERSION=4.0.3
5+
language: node_js
6+
node_js:
7+
- "node"
8+
- "lts/*"
9+
- "7"
10+
- "8"
11+
before_install:
12+
- npm install -g npm@latest
13+
- npm install -g eye.js
14+
install:
15+
- eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" # Install swift
16+
script:
17+
- eye # JS
18+
- swiftc swift/lib.swift -o out # Swift
19+
- swift __test__/test.swift # Swift testing
20+
- cd c && make # C
21+
notifications:
22+
email: false

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Arthur Guiot
3+
Copyright (c) 2018 CrypTools
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+63-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,63 @@
1-
# template
2-
Our official Trowler template.
1+
# NAME
2+
<p align="center">
3+
<!-- replace image by project Image -->
4+
<img height="128" src="https://cryptools.github.io/img/NAME.svg">
5+
</p>
6+
<p align="center">
7+
<img src="https://cryptools.github.io/img/status/implemented.svg">
8+
<img src="https://img.shields.io/travis/CrypTools/NAME.svg">
9+
<img src="https://img.shields.io/github/license/Cryptools/NAME.svg">
10+
<img src="https://img.shields.io/github/contributors/Cryptools/NAME.svg">
11+
</p>
12+
13+
<!-- Description -->
14+
15+
## How it works
16+
17+
### Encoding
18+
19+
<!-- Explanations for encoding -->
20+
21+
### Decoding
22+
23+
<!-- Explanations for decoding -->
24+
25+
## Pros & Cons
26+
27+
### Pros
28+
29+
<!-- Pros as list -->
30+
31+
### Cons
32+
33+
<!-- Cons as list -->
34+
35+
## Implementations
36+
37+
| Language | Encrypt | Decrypt |
38+
|------------|-----------------------------|-----------------------------|
39+
| Javascript | [encrypt.js](js/encrypt.js) | [decrypt.js](js/decrypt.js) |
40+
| Python | [encrypt.py](py/encrypt.py) | [decrypt.py](py/decrypt.py) |
41+
| Swift | [lib.swift](swift/lib.swift)| [lib.swift](swift/lib.swift)|
42+
43+
## Running the tests
44+
45+
Tests are automatically handled by [Travis CI](https://travis-ci.org/CrypTools/NAME/).
46+
47+
## Contributing
48+
49+
Please read [CONTRIBUTING.md](https://github.com/CrypTools/cryptools.github.io/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
50+
51+
## Versioning
52+
53+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/CrypTools/NAME/tags).
54+
55+
## Authors
56+
57+
Made with ❤️ at CrypTools.
58+
59+
See also the list of [contributors](https://github.com/CrypTools/NAME/contributors) who participated in this project.
60+
61+
## License
62+
63+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

js/__test__/test.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Test made using EyeJS - https://eye.js.org
2+
3+
const path = require('path').normalize(__testDir + "/../")
4+
5+
const { encrypt, decrypt } = require(path + "lib.js")
6+
7+
8+
eye.test("Encryption", "node",
9+
$ => $(encrypt("Hello World!")).Equal(OUTPUT)
10+
)
11+
eye.test("Decryption", "node",
12+
$ => $(decrypt("ENCRYPTED STR")).Equal("Hello World!"),
13+
$ => $(decrypt(encrypt("Hello World!"))).Equal("Hello World!")
14+
)

js/decrypt.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* ==========================================================================
2+
*
3+
* Use:
4+
* "ENCRYPTED STR".decrypt()
5+
* => Hello World!
6+
*
7+
* ========================================================================== */
8+
9+
10+
String.prototype.decrypt = function () {
11+
return decrypted
12+
};
13+
14+
module.exports = text => text.decrypt()

js/encrypt.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* ==========================================================================
2+
*
3+
* Use:
4+
* "Hello World!".encrypt()
5+
* => OUTPUT
6+
*
7+
* ========================================================================== */
8+
9+
10+
String.prototype.encrypt = function () {
11+
return encrypted
12+
};
13+
14+
module.exports = text => text.encrypt()

js/lib.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**********************
2+
3+
Simple bridge
4+
5+
**********************/
6+
7+
const encrypt = require("./encrypt")
8+
const decrypt = require("./decrypt")
9+
10+
module.exports = {
11+
encrypt: encrypt,
12+
decrypt: decrypt
13+
}

py/decrypt.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ==============================================================================
2+
#
3+
# Use:
4+
# decrypt("ENCRYPTED STR")
5+
# => "Hello World!"
6+
#
7+
# ==============================================================================
8+
9+
def decrypt(text):
10+
return decrypted

py/encrypt.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ==============================================================================
2+
#
3+
# Use:
4+
# encrypt("Hello World!")
5+
# => OUTPUT
6+
#
7+
# ==============================================================================
8+
9+
def encrypt(text):
10+
return encrypted

swift/lib.swift

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* ==========================================================================
2+
*
3+
* Use:
4+
* "Hello World!".encrypt.decrypt
5+
* => "Hello World!"
6+
*
7+
* ========================================================================== */
8+
9+
import Foundation
10+
11+
extension String {
12+
var encrypt: String {
13+
14+
}
15+
var decrypt: String {
16+
17+
}
18+
}

0 commit comments

Comments
 (0)