Skip to content

Commit

Permalink
change style and add flavicon
Browse files Browse the repository at this point in the history
  • Loading branch information
stefdelec committed Feb 4, 2018
1 parent 1669703 commit 862f4b0
Show file tree
Hide file tree
Showing 13 changed files with 445 additions and 111 deletions.
6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/private-md5.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

320 changes: 320 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file removed public/favicon.ico
Binary file not shown.
Binary file added public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="icon" type="image/png" href="%PUBLIC_URL%/favicon.png" />

<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand All @@ -21,7 +22,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Encr.it</title>
</head>
<body>
<noscript>
Expand Down
96 changes: 53 additions & 43 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,63 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import React, {Component} from 'react';
import './App.css';
import Input from "./components/input";
import Md5Hash from './components/cryptomd5';
import SpecialHash from './components/specialhash';
import * as crypto from 'crypto'
import CopyPasteInput from "./components/copy-paste-input";

class App extends Component {
constructor(props) {
super(props);
this.state = { value: 'my amazing easy password', toggle: false };
this.change = this.change.bind(this);
this.toggle = this.toggle.bind(this);
}
change(event) {
// this.setState({value: event.target.value});
this.setState({ value: event.target.value });
}
toggle() {
console.log((!this.state.toggle));
this.setState({ toggle: !this.state.toggle });
console.log(this.state.toggle);
}
render() {
return (
<div className="container">
<div className='row'>
<div className='col-12'>
{Input(this.change)}
</div>
<div className='col-12'>
<button className="btn btn-info btn-block" onClick={() => this.toggle()}>
{this.state.toggle? this.state.value : 'voir'}
</button>
<hr />
</div>
<div className='col-12'>
{Md5Hash(this.state.value)}
<hr />
constructor(props) {
super(props);
this.state = {value: 'my amazing easy password', toggle: false};
this.change = this.change.bind(this);
this.toggle = this.toggle.bind(this);
}

</div>
<div className='col-12'>
{SpecialHash(this.state.value)}
<hr />
change(event) {
// this.setState({value: event.target.value});
this.setState({value: event.target.value});
}


toggle() {
this.setState({toggle: !this.state.toggle});
}

md5(key) {
return crypto.createHash('md5').update(key).digest("hex");
}

base64(key) {
return btoa(key);
}

render() {
return (
<div className="container">
<div className='row'>
<div className='col-12'>
{Input(this.change)}
</div>
<div className='col-12'>
<button className="btn btn-info btn-block" onClick={() => this.toggle()}>
{this.state.toggle ? this.state.value : 'voir'}
</button>
<hr/>
</div>
<div className='col-12'>
<h3>MD5</h3>
{CopyPasteInput(this.md5(this.state.value))}
<hr/>

</div>
<div className='col-12'>
<h3>MD5=>Base64</h3>
{CopyPasteInput(this.base64(this.md5(this.state.value)))}
<hr/>
</div>
</div>
</div>
</div>
</div>
);
}
);
}
}

export default App;
37 changes: 37 additions & 0 deletions src/components/copy-paste-input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react'
import * as crypto from 'crypto'

const CopyPasteInput = (str) => {
const guid = () => {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}

return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
}
const copyPast = () => {
var copyText = document.getElementById(idKey);
copyText.select();
document.execCommand("Copy");
};
const idKey = guid();
return (
<div className="row">
<div className="col-12">
<div className="input-group mb-3">
<div className="input-group-prepend">
<button onClick={() => copyPast()} className="btn btn-lg btn-primary">COPY</button>
</div>
<input readOnly
type="text" value={str} className="form-control" id={idKey} placeholder="Your Next-password" />
</div>
</div>
</div>

)
}

export default CopyPasteInput
31 changes: 0 additions & 31 deletions src/components/cryptomd5.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/input.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'

const Input = (change) => {
const Input = (change,type) => {
return (
<div className="form-group">
<div className="form-group">
<label htmlFor="inputPassword">Password</label>
<input type='password' onChange={change} className="form-control" id="inputPassword" placeholder="Your Password" />
<input type="password" onChange={change} className="form-control" id="inputPassword" placeholder="Your Password" />
</div>

)
Expand Down
32 changes: 0 additions & 32 deletions src/components/specialhash.js

This file was deleted.

0 comments on commit 862f4b0

Please sign in to comment.