diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index effe43c..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -## 1.0.0 - -- Initial version. diff --git a/README.md b/README.md index c47cd17..4603ddc 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ -# WhatFreeWords +![bunny](bunny.png) + +# Map3Terms [![](http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl-badge-4.png")](http://www.wtfpl.net/) -This is the Dart port of the original [JavaScript implementation](https://github.com/pballett/whatfreewords) that was published as a small test to show how one might reversibly map each ~1m² element of the globe onto a 3-tuple of words. +This is the Dart port of the original [JavaScript implementation](https://github.com/pballett/map3terms) of a small but ingenious test to show how one might reversibly map roughly each square meter of the globe onto a 3-tuple of words using a simplified symmetric encryption method called [Feistel cipher](https://en.wikipedia.org/wiki/Feistel_cipher). + +It seems inspired by the existing proprietary geocoding service [What3Words](https://wiki.openstreetmap.org/wiki/What3words) but uses a completely different method and list of words. ## Installation @@ -10,15 +14,15 @@ In your Flutter/Dart `pubspec.yaml` file include ```yaml dependencies: - whatfreewords: + map3terms: git: - url: https://github.com/randogoth/whatfreewords.git + url: https://github.com/randogoth/map3terms.git ``` ## Usage ```dart -import 'package:whatfreewords/whatfreewords.dart'; +import 'package:map3terms/map3terms.dart'; // coordinate to wfw final List coord = [51.50844113, -0.116708278]; @@ -30,7 +34,7 @@ final coords = wordsToCoord(words); print(coords); // [51.5084, -0.1167] ``` -Check it out [here](https://pballett.github.io/whatfreewords/). +Check it out [here](https://pballett.github.io/map3terms/). To do this we needed three things: 1. A function which maps metre-accurate (latitude, longitude) pairs into three 5-digit integers below 40k. diff --git a/bunny.png b/bunny.png new file mode 100644 index 0000000..881fd1b Binary files /dev/null and b/bunny.png differ diff --git a/example/map3terms_example.dart b/example/map3terms_example.dart new file mode 100644 index 0000000..7471e87 --- /dev/null +++ b/example/map3terms_example.dart @@ -0,0 +1,11 @@ +import 'package:map3terms/map3terms.dart'; + +void main() { + List coordinate = [51.50844113, -0.116708278]; + + String words = await coordToWords(coordinate); + print("Words: $words"); + + List backToCoord = await wordsToCoord(words); + print("Coordinates: ${backToCoord[0]}, ${backToCoord[1]}"); +} diff --git a/example/whatfreewords_example.dart b/example/whatfreewords_example.dart deleted file mode 100644 index f8cc935..0000000 --- a/example/whatfreewords_example.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:whatfreewords/whatfreewords.dart'; - -void main() { - var awesome = Awesome(); - print('awesome: ${awesome.isAwesome}'); -} diff --git a/lib/map3terms.dart b/lib/map3terms.dart new file mode 100644 index 0000000..7286f72 --- /dev/null +++ b/lib/map3terms.dart @@ -0,0 +1,3 @@ +library map3terms; + +export 'src/map3terms_scrambler.dart'; \ No newline at end of file diff --git a/lib/src/whatfreewords_base.dart b/lib/src/map3terms_base.dart similarity index 100% rename from lib/src/whatfreewords_base.dart rename to lib/src/map3terms_base.dart diff --git a/lib/src/whatfreewords_cipher.dart b/lib/src/map3terms_map.dart similarity index 100% rename from lib/src/whatfreewords_cipher.dart rename to lib/src/map3terms_map.dart diff --git a/lib/src/whatfreewords_scrambler.dart b/lib/src/map3terms_scrambler.dart similarity index 99% rename from lib/src/whatfreewords_scrambler.dart rename to lib/src/map3terms_scrambler.dart index 244a29c..ac10945 100644 --- a/lib/src/whatfreewords_scrambler.dart +++ b/lib/src/map3terms_scrambler.dart @@ -1,5 +1,5 @@ import 'dart:math'; -import 'whatfreewords_cipher.dart'; +import 'map3terms_map.dart'; final Map ilist = wlist.map((key, value) => MapEntry(value, key)); diff --git a/lib/whatfreewords.dart b/lib/whatfreewords.dart deleted file mode 100644 index 3e17f1a..0000000 --- a/lib/whatfreewords.dart +++ /dev/null @@ -1,3 +0,0 @@ -library whatfreewords; - -export 'src/whatfreewords_scrambler.dart'; \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index fe1ff46..2d6aa50 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ -name: whatfreewords +name: map3terms description: A library for converting coordinates to words and back using a Feistel network. version: 1.0.0 -homepage: https://github.com/randogoth/whatfreewords +homepage: https://github.com/randogoth/map3terms environment: sdk: '>=2.17.0 <3.0.0' diff --git a/test/whatfreewords_test.dart b/test/map3terms_test.dart similarity index 96% rename from test/whatfreewords_test.dart rename to test/map3terms_test.dart index fffb735..ed4dd8e 100644 --- a/test/whatfreewords_test.dart +++ b/test/map3terms_test.dart @@ -1,11 +1,11 @@ import 'package:test/test.dart'; import 'dart:math'; -import 'package:whatfreewords/whatfreewords.dart'; +import 'package:map3terms/map3terms.dart'; void main() { - group('WhatFreeWords Tests', () { + group('map3terms Tests', () { test('Coordinate to Words and Back', () async { final List coord = [51.50844113, -0.116708278]; final words = await coordToWords(coord);