12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 'use strict';
- function MainController($scope, $routeParams) {
- $scope.allowedLengths = [4, 8, 16, 32, 64, 128, 256];
- $scope.binaryLength = 64;
- $scope.binary = generateBinary($scope.binaryLength);
- $scope.parts = [];
- $scope.hex = "";
-
- $scope.displayResults = function () {
- return $scope.hex.length > 0;
- };
-
- $scope.generate = function () {
- $scope.binary = generateBinary($scope.binaryLength);
- $scope.parts = [];
- $scope.hex = "";
-
- return false;
- };
-
- $scope.solve = function () {
- $scope.parts = [];
- $scope.hex = "";
-
- var original = $scope.binary;
-
- while (original.length > 0) {
-
- var part = original.substr(-4);
- var character = binaryToHex(part);
-
-
- $scope.parts.push({ "binary": part, "hex": character });
- $scope.hex = character + $scope.hex;
-
-
- original = original.substr(0, original.length - 4);
- }
-
- return false;
- };
- }
|