2018-02-14 01:16:58 +00:00
|
|
|
#include <iostream>
|
2018-02-28 23:07:39 +00:00
|
|
|
#include <string>
|
2018-02-15 23:09:09 +00:00
|
|
|
#include "sock/tcpsock.hpp"
|
2018-02-28 23:07:39 +00:00
|
|
|
#include "utils/string.hpp"
|
2018-03-01 23:16:47 +00:00
|
|
|
#include "utils/net.hpp"
|
2018-03-05 23:23:07 +00:00
|
|
|
#include "utils/time.hpp"
|
2018-03-07 23:07:28 +00:00
|
|
|
#include "sock/tcpsock.hpp"
|
2018-03-15 04:01:24 +00:00
|
|
|
#include "crypto/sha1.hpp"
|
2018-03-15 22:02:10 +00:00
|
|
|
#include "crypto/base64.hpp"
|
2018-03-20 22:42:26 +00:00
|
|
|
#include "crypto/bfish.hpp"
|
|
|
|
#include "utils/csprng.hpp"
|
2018-03-21 04:29:24 +00:00
|
|
|
#include "crypto/bcrypt.hpp"
|
2018-03-21 22:07:30 +00:00
|
|
|
#include "utils/bigint.hpp"
|
2018-02-14 01:16:58 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2018-02-16 22:34:22 +00:00
|
|
|
//auto sock = sosc::TcpClient();
|
|
|
|
|
2018-03-01 23:16:47 +00:00
|
|
|
/*std::string a = "this!!is!!a!!test";
|
2018-02-28 23:07:39 +00:00
|
|
|
auto b = sosc::str::split(a, "!!");
|
|
|
|
std::for_each(b.begin(), b.end(), [](std::string& i) {
|
|
|
|
std::cout << i << std::endl;
|
2018-03-01 23:16:47 +00:00
|
|
|
});*/
|
|
|
|
|
2018-03-08 04:27:54 +00:00
|
|
|
/*sosc::TcpClient client;
|
|
|
|
client.Open("127.0.0.1", 1111);
|
2018-03-01 23:16:47 +00:00
|
|
|
|
2018-03-07 23:07:28 +00:00
|
|
|
client.Send("test");
|
2018-03-08 04:27:54 +00:00
|
|
|
std::string got = "abc";
|
2018-03-07 23:07:28 +00:00
|
|
|
|
|
|
|
while(client.IsOpen()) {
|
2018-03-08 04:27:54 +00:00
|
|
|
int length = client.Receive(&got);
|
2018-03-07 23:07:28 +00:00
|
|
|
|
|
|
|
if(length > 0)
|
|
|
|
std::cout << got << std::endl;
|
2018-03-08 04:27:54 +00:00
|
|
|
}*/
|
2018-02-15 23:09:09 +00:00
|
|
|
|
2018-03-15 22:02:10 +00:00
|
|
|
//std::string a = sosc::cgc::sha1("test", true);
|
|
|
|
|
2018-03-21 04:29:24 +00:00
|
|
|
/*sosc::cgc::Blowfish fish("TESTKEY");
|
2018-03-20 22:42:26 +00:00
|
|
|
|
|
|
|
std::string test = fish.Encrypt("imagine a test");
|
|
|
|
std::string testd = fish.Decrypt(test);
|
|
|
|
|
|
|
|
uint32_t teest = sosc::csprng::next<uint32_t>();
|
2018-03-21 04:29:24 +00:00
|
|
|
std::cout << std::hex << teest;*/
|
|
|
|
|
2018-03-21 22:07:30 +00:00
|
|
|
/*std::string hash = sosc::cgc::bcrypt_hash("test pwd");
|
|
|
|
std::cout << hash << std::endl;
|
|
|
|
std::cout << sosc::cgc::bcrypt_check("test pwd", hash);*/
|
|
|
|
|
2018-03-22 22:04:41 +00:00
|
|
|
sosc::BigUInt a, b;
|
|
|
|
|
2018-03-23 03:27:13 +00:00
|
|
|
a.Parse("368BEADA711E83274DAF974D1A1A10EB915023D016CFC8BFAB58E5D848CF8D45");
|
|
|
|
|
2018-03-22 22:04:41 +00:00
|
|
|
//assert(a - b == sosc::BigUInt("feff01"));
|
|
|
|
|
2018-03-23 03:27:13 +00:00
|
|
|
//auto d = sosc::BigUInt::DivideWithRemainder(a, b);
|
|
|
|
|
|
|
|
/*for(int i = a.ByteCount() * 8 - 1; i >= 0; --i) {
|
|
|
|
std::cout << a.GetBit(i);
|
|
|
|
b.SetBit(i, a.GetBit(i));
|
|
|
|
}*/
|
|
|
|
|
|
|
|
//std::cout << sosc::BigUInt::GenerateRandomPrime(64).ToString();
|
|
|
|
//std::cout << a.IsProbablePrime();
|
|
|
|
|
|
|
|
for(int i = 0; i < 250; ++i)
|
|
|
|
a*a;
|
|
|
|
|
|
|
|
//std::cout << a.ToString();
|
2018-03-22 22:04:41 +00:00
|
|
|
|
2018-03-23 03:27:13 +00:00
|
|
|
/*std::cout << std::endl << std::endl
|
|
|
|
<< d.result.ToString()
|
|
|
|
<< std::endl
|
|
|
|
<< d.remainder.ToString();*/
|
2018-03-20 22:42:26 +00:00
|
|
|
|
2018-02-14 01:16:58 +00:00
|
|
|
return 0;
|
|
|
|
}
|