如何将 sqlite 数据库集成到我的 c++ 程序中,该程序将存储指定的 cin 条目
How to integrate a sqlite database into my c++ program that will store specified cin entries
我正在尝试结合 C++ 和 SQLite 为 sha-256 哈希创建数据库。我需要数据库来导入、存储和导出 sha-256 哈希值和含义。我已经可以运行 C++ 程序了。该程序要求用户根据需要创建自己的库,我希望为所有用户存储条目。这将扩展库并使其在继续存在时更有用。我对 cpp 还很陌生,所以现有的程序有点基础。我正在寻找的是一种将变量从 cpp 移动到 sqlite 以及干净集成所需的任何其他步骤的方法。
谢谢!
下面是现有的cpp和sqlite
//include libraries
//Sorry,this is in a js compiler becuase i coulnd't figure out how to post it as cpp, the program itsellf works in cpp.
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
//if user wants to run this
std::string yon;
std::cout << "Type 'yes' to add 25 custom hashes to your library, type no to skip.\n";
std::cin >> yon;
if (yon == "yes") {
//int var for user library
std::string hash;
std::string meaning;
std::string hash1;
std::string meaning1;
std::string hash2;
std::string meaning2;
std::string hash3;
std::string meaning3;
std::string hash4;
std::string meaning4;
std::string hash5;
std::string meaning5;
std::string hash6;
std::string meaning6;
std::string hash7;
std::string meaning7;
std::string hash8;
std::string meaning8;
std::string hash9;
std::string meaning9;
std::string hash10;
std::string meaning10;
std::string hash11;
std::string meaning11;
std::string hash12;
std::string meaning12;
std::string hash13;
std::string meaning13;
std::string hash14;
std::string meaning14;
std::string hash15;
std::string meaning15;
std::string hash16;
std::string meaning16;
std::string hash17;
std::string meaning17;
std::string hash18;
std::string meaning18;
std::string hash19;
std::string meaning19;
std::string hash20;
std::string meaning20;
std::string hash21;
std::string meaning21;
std::string hash22;
std::string meaning22;
std::string hash23;
std::string meaning23;
std::string hash24;
std::string meaning24;
//var user library
std::cout << "Do not restart this learning repository or else variables will be forgotten\n";
std::cout << "Enter first hash\n";
std::cin >> hash;
std::cout << "Enter first meaning\n";
std::cin >> meaning;
std::cout << "Enter hash\n";
std::cin >> hash1;
std::cout << "Enter meaning\n";
std::cin >> meaning1;
std::cout << "Enter hash\n";
std::cin >> hash2;
std::cout << "Enter meaning\n";
std::cin >> meaning2;
std::cout << "Enter hash\n";
std::cin >> hash3;
std::cout << "Enter meaning\n";
std::cin >> meaning3;
std::cout << "Enter hash\n";
std::cin >> hash4;
std::cout << "Enter meaning\n";
std::cin >> meaning4;
std::cout << "Enter hash\n";
std::cin >> hash5;
std::cout << "Enter meaning\n";
std::cin >> meaning5;
std::cout << "Enter hash\n";
std::cin >> hash6;
std::cout << "Enter meaning\n";
std::cin >> meaning6;
std::cout << "Enter hash\n";
std::cin >> hash7;
std::cout << "Enter meaning\n";
std::cin >> meaning7;
std::cout << "Enter hash\n";
std::cin >> hash8;
std::cout << "Enter meaning\n";
std::cin >> meaning8;
std::cout << "Enter hash\n";
std::cin >> hash9;
std::cout << "Enter meaning\n";
std::cin >> meaning9;
std::cout << "Enter hash\n";
std::cin >> hash10;
std::cout << "Enter meaning\n";
std::cin >> meaning10;
std::cout << "Enter hash\n";
std::cin >> hash11;
std::cout << "Enter meaning\n";
std::cin >> meaning11;
std::cout << "Enter hash\n";
std::cin >> hash12;
std::cout << "Enter meaning\n";
std::cin >> meaning12;
std::cout << "Enter hash\n";
std::cin >> hash13;
std::cout << "Enter meaning\n";
std::cin >> meaning13;
std::cout << "Enter hash\n";
std::cin >> hash14;
std::cout << "Enter meaning\n";
std::cin >> meaning14;
std::cout << "Enter hash\n";
std::cin >> hash15;
std::cout << "Enter meaning\n";
std::cin >> meaning15;
std::cout << "Enter hash\n";
std::cin >> hash16;
std::cout << "Enter meaning\n";
std::cin >> meaning16;
std::cout << "Enter hash\n";
std::cin >> hash17;
std::cout << "Enter meaning\n";
std::cin >> meaning17;
std::cout << "Enter hash\n";
std::cin >> hash18;
std::cout << "Enter meaning\n";
std::cin >> meaning18;
std::cout << "Enter hash\n";
std::cin >> hash19;
std::cout << "Enter meaning\n";
std::cin >> meaning19;
std::cout << "Enter hash\n";
std::cin >> hash20;
std::cout << "Enter meaning\n";
std::cin >> meaning20;
std::cout << "Enter hash\n";
std::cin >> hash21;
std::cout << "Enter meaning\n";
std::cin >> meaning21;
std::cout << "Enter hash\n";
std::cin >> hash22;
std::cout << "Enter meaning\n";
std::cin >> meaning22;
std::cout << "Enter hash\n";
std::cin >> hash23;
std::cout << "Enter meaning\n";
std::cin >> meaning23;
std::cout << "Enter hash\n";
std::cin >> hash24;
std::cout << "Enter meaning\n";
std::cin >> meaning24;
std::cout << "Done, returning to main program now!\n";
//intilize variables and startup
std::string name;
std::string securitykey = "Echoes";
std::string usersecuritykey;
std::cout << "Please enter the program security key\n (key = Echoes)\n";
std::cin >> usersecuritykey;
//security key
if (usersecuritykey == securitykey) {
std::cout << "Please enter your name\n";
std::cin >> name;
std::cout << "Hello " << name << ", Input First Secure hash algorithm 256 hash to be mined\n";
for( ; ; ) {
std::string input1;
std::cin >> input1;
//if else library
//words
if (input1 == "8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4") {
std::cout << "hi\n";
} else if (input1 == "b49f425a7e1f9cff3856329ada223f2f9d368f15a00cf48df16ca95986137fe8") {
std::cout << "bye\n";
} else if (input1 == "b9776d7ddf459c9ad5b0e1d6ac61e27befb5e99fd62446677600d7cacef544d0") {
std::cout << "the\n";
} else if (input1 == "28391d3bc64ec15cbb090426b04aa6b7649c3cc85f11230bb0105e02d15e3624") {
std::cout << "of\n";
} else if (input1 == "6201111b83a0cb5b0922cb37cc442b9a40e24e3b1ce100a4bb204f4c63fd2ac0") {
std::cout << "and\n";
} else if (input1 == "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb") {
std::cout << "a\n";
} else if (input1 == "663ea1bfffe5038f3f0cf667f14c4257eff52d77ce7f2a218f72e9286616ea39") {
std::cout << "to\n";
} else if (input1 == "582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf") {
std::cout << "in\n";
//letters
} else if (input1 == "3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d") {
std::cout << "b\n";
} else if (input1 == "2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1a25aefc6") {
std::cout << "c\n";
} else if (input1 == "18ac3e7343f016890c510e93f935261169d9e3f565436429830faf0934f4f8e4") {
std::cout << "d\n";
} else if (input1 == "3f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea") {
std::cout << "e\n";
} else if (input1 == "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111") {
std::cout << "f\n";
} else if (input1 == "cd0aa9856147b6c5b4ff2b7dfee5da20aa38253099ef1b4a64aced233c9afe29") {
std::cout << "g\n";
} else if (input1 == "aaa9402664f1a41f40ebbc52c9993eb66aeb366602958fdfaa283b71e64db123") {
std::cout << "h\n";
} else if (input1 == "de7d1b721a1e0632b7cf04edf5032c8ecffa9f9a08492152b926f1a5a7e765d7") {
std::cout << "i\n";
} else if (input1 == "189f40034be7a199f1fa9891668ee3ab6049f82d38c68be70f596eab2e1857b7") {
std::cout << "j\n";
} else if (input1 == "8254c329a92850f6d539dd376f4816ee2764517da5e0235514af433164480d7a") {
std::cout << "k\n";
} else if (input1 == "acac86c0e609ca906f632b0e2dacccb2b77d22b0621f20ebece1a4835b93f6f0") {
std::cout << "l\n";
} else if (input1 == "62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a") {
std::cout << "m\n";
} else if (input1 == "1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9") {
std::cout << "n\n";
} else if (input1 == "65c74c15a686187bb6bbf9958f494fc6b80068034a659a9ad44991b08c58f2d2") {
std::cout << "o\n";
} else if (input1 == "148de9c5a7a44d19e56cd9ae1a554bf67847afb0c58f6e12fa29ac7ddfca9940") {
std::cout << "p\n";
} else if (input1 == "8e35c2cd3bf6641bdb0e2050b76932cbb2e6034a0ddacc1d9bea82a6ba57f7cf") {
std::cout << "q\n";
} else if (input1 == "454349e422f05297191ead13e21d3db520e5abef52055e4964b82fb213f593a1") {
std::cout << "r\n";
} else if (input1 == "043a718774c572bd8a25adbeb1bfcd5c0256ae11cecf9f9c3f925d0e52beaf89") {
std::cout << "s\n";
} else if (input1 == "e3b98a4da31a127d4bde6e43033f66ba274cab0eb7eb1c70ec41402bf6273dd8") {
std::cout << "t\n";
} else if (input1 == "0bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad6") {
std::cout << "u\n";
} else if (input1 == "4c94485e0c21ae6c41ce1dfe7b6bfaceea5ab68e40a2476f50208e526f506080") {
std::cout << "v\n";
} else if (input1 == "50e721e49c013f00c62cf59f2163542a9d8df02464efeb615d31051b0fddc326") {
std::cout << "w\n";
} else if (input1 == "2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881") {
std::cout << "x\n";
} else if (input1 == "a1fce4363854ff888cff4b8e7875d600c2682390412a8cf79b37d0b11148b0fa") {
std::cout << "y\n";
} else if (input1 == "594e519ae499312b29433b7dd8a97ff068defcba9755b6d5d00e84c524d67b06") {
std::cout << "z\n";
} else if (input1 == "fa51fd49abf67705d6a35d18218c115ff5633aec1f9ebfdc9d5d4956416f57f6") {
//more words
std::cout << "is\n";
} else if (input1 == "bb0347a468d97e98a9c00e37cebec1ab930f6f1221cae0f1fbb92b07e1900ba2") {
std::cout << "you\n";
} else if (input1 == "8e7fc0236af43df9340685fc16f1efe36543cc1707051220a103ad99cf69a2df") {
std::cout << "that\n";
} else if (input1 == "2ad8a7049d7c5511ac254f5f51fe70a046ebd884729056f0fe57f5160d467153") {
std::cout << "it\n";
} else if (input1 == "372f7e2fd2d01ce2a1d71dc072acbba4c6fd25a1087cd7f153f4ec0ce37e1ede") {
std::cout << "he\n";
} else if (input1 == "b63b99f6383ba713b57ddfc77737c5f71639fa6f4663efe60a66a8c6d114b545") {
std::cout << "was\n";
} else if (input1 == "10c22bcf4c768b515be4e94bcafc71bf3e8fb5f70b2584bcc8c7533217f2e7f9") {
std::cout << "for\n";
} else if (input1 == "b8d31e852725afb1e26d53bab6095b2bff1749c9275be13ed1c05a56ed31ec09") {
std::cout << "on\n";
} else if (input1 == "ba78973ddcf98d4e5369f5e722d681d94f5106895e5d6cf6fa3ca8240fabdc14") {
std::cout << "are\n";
} else if (input1 == "f4bf9f7fcbedaba0392f108c59d8f4a38b3838efb64877380171b54475c2ade8") {
std::cout << "as\n";
} else if (input1 == "0695b563acde461fc2f8d9aebccf35c7596ac458b8d8e067c602fb7b4e5f1578") {
std::cout << "with\n";
} else if (input1 == "73c9c98668a34c54d131ff609d0bf129068d1b5ed3efd7cdfe753f909596456c") {
std::cout << "his\n";
} else if (input1 == "151e58a831306903b282edb477bb6c4b713887cdd2b0353c84aff6f43da8e95d") {
std::cout << "they\n";
} else if (input1 == "de7d1b721a1e0632b7cf04edf5032c8ecffa9f9a08492152b926f1a5a7e765d7"
) {
std::cout << "i\n";
} else if (input1 == "9390298f3fb0c5b160498935d79cb139aef28e1c47358b4bbba61862b9c26e59"){
std::cout << "no\n";
} else if (input1 == "8a798890fe93817163b10b5f7bd2ca4d25d84c52739a645a889c173eee7d9d3d") {
std::cout << "yes\n";
//funny easter egg
} else if (input1 == "no") {
std::cout << "dont be rude :)\n";
} else if (input1 == "d7469a66c4bb97c09aa84e8536a85f1795761f5fe01ddc8139922b6236f4397d") {
std::cout << "Happy birthday\n https://Birthday.belizairebr25.repl.co\n";
} else if (input1 == hash) {
std::cout << meaning <<"\n";
}else if (input1 == hash1) {
std::cout << meaning1 <<"\n";
}else if (input1 == hash2) {
std::cout << meaning2 <<"\n";
}else if (input1 == hash3) {
std::cout << meaning3 <<"\n";
}else if (input1 == hash4) {
std::cout << meaning4 <<"\n";
}else if (input1 == hash5) {
std::cout << meaning5 <<"\n";
}else if (input1 == hash6) {
std::cout << meaning6 <<"\n";
}else if (input1 == hash7) {
std::cout << meaning7 <<"\n";
}else if (input1 == hash8) {
std::cout << meaning8 <<"\n";
}else if (input1 == hash9) {
std::cout << meaning9 <<"\n";
}else if (input1 == hash10) {
std::cout << meaning10 <<"\n";
}else if (input1 == hash11) {
std::cout << meaning11 <<"\n";
}else if (input1 == hash12) {
std::cout << meaning12 <<"\n";
}else if (input1 == hash13) {
std::cout << meaning13 <<"\n";
}else if (input1 == hash14) {
std::cout << meaning14 <<"\n";
}else if (input1 == hash15) {
std::cout << meaning15 <<"\n";
}else if (input1 == hash16) {
std::cout << meaning16 <<"\n";
}else if (input1 == hash17) {
std::cout << meaning17 <<"\n";
}else if (input1 == hash18) {
std::cout << meaning18 <<"\n";
}else if (input1 == hash19) {
std::cout << meaning19 <<"\n";
}else if (input1 == hash20) {
std::cout << meaning20 <<"\n";
}else if (input1 == hash21) {
std::cout << meaning21 <<"\n";
}else if (input1 == hash22) {
std::cout << meaning22 <<"\n";
}else if (input1 == hash23) {
std::cout << meaning23 <<"\n";
}else if (input1 == hash24) {
std::cout << meaning24 <<"\n";
}
std::cout << "Enter next hash\n";
}
}else{
std::cout << "Secure hash algorithm 256 hash not automatically recognized.\n Mining, this may take a while\n";
/*mine goes here, it measures random inputs against the user input to see if the match, encatt is used to measure and att is the attempted solution. It does not et work work yet, the below code is not mine and I am altering it in the hopes of getting it to work*/
std::cout << "Hash not recognized\n";
}
} else {
//no custom library option/object2
//intilize variables and startup
std::string name;
std::string securitykey = "Echoes";
std::string usersecuritykey;
std::cout << "Please enter the program security key\n (key = Echoes)\n";
std::cin >> usersecuritykey;
//security key
if (usersecuritykey == securitykey) {
std::cout << "Please enter your name\n";
std::cin >> name;
for( ; ; ) {
std::cout << "Hello " << name << ", Input Secure hash algorithm 256 hash to be mined\n";
std::string inputa;
std::cin >> inputa;
//if else library
//words
if (inputa == "8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4") {
std::cout << "hi\n";
} else if (inputa == "b49f425a7e1f9cff3856329ada223f2f9d368f15a00cf48df16ca95986137fe8") {
std::cout << "bye\n";
} else if (inputa == "b9776d7ddf459c9ad5b0e1d6ac61e27befb5e99fd62446677600d7cacef544d0") {
std::cout << "the\n";
} else if (inputa == "28391d3bc64ec15cbb090426b04aa6b7649c3cc85f11230bb0105e02d15e3624") {
std::cout << "of\n";
} else if (inputa == "6201111b83a0cb5b0922cb37cc442b9a40e24e3b1ce100a4bb204f4c63fd2ac0") {
std::cout << "and\n";
} else if (inputa == "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb") {
std::cout << "a\n";
} else if (inputa == "663ea1bfffe5038f3f0cf667f14c4257eff52d77ce7f2a218f72e9286616ea39") {
std::cout << "to\n";
} else if (inputa == "582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf") {
std::cout << "in\n";
//letters
} else if (inputa == "3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d") {
std::cout << "b\n";
} else if (inputa == "2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1a25aefc6") {
std::cout << "c\n";
} else if (inputa == "18ac3e7343f016890c510e93f935261169d9e3f565436429830faf0934f4f8e4") {
std::cout << "d\n";
} else if (inputa == "3f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea") {
std::cout << "e\n";
} else if (inputa == "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111") {
std::cout << "f\n";
} else if (inputa == "cd0aa9856147b6c5b4ff2b7dfee5da20aa38253099ef1b4a64aced233c9afe29") {
std::cout << "g\n";
} else if (inputa == "aaa9402664f1a41f40ebbc52c9993eb66aeb366602958fdfaa283b71e64db123") {
std::cout << "h\n";
} else if (inputa == "de7d1b721a1e0632b7cf04edf5032c8ecffa9f9a08492152b926f1a5a7e765d7") {
std::cout << "i\n";
} else if (inputa == "189f40034be7a199f1fa9891668ee3ab6049f82d38c68be70f596eab2e1857b7") {
std::cout << "j\n";
} else if (inputa == "8254c329a92850f6d539dd376f4816ee2764517da5e0235514af433164480d7a") {
std::cout << "k\n";
} else if (inputa == "acac86c0e609ca906f632b0e2dacccb2b77d22b0621f20ebece1a4835b93f6f0") {
std::cout << "l\n";
} else if (inputa == "62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a") {
std::cout << "m\n";
} else if (inputa == "1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9") {
std::cout << "n\n";
} else if (inputa == "65c74c15a686187bb6bbf9958f494fc6b80068034a659a9ad44991b08c58f2d2") {
std::cout << "o\n";
} else if (inputa == "148de9c5a7a44d19e56cd9ae1a554bf67847afb0c58f6e12fa29ac7ddfca9940") {
std::cout << "p\n";
} else if (inputa == "8e35c2cd3bf6641bdb0e2050b76932cbb2e6034a0ddacc1d9bea82a6ba57f7cf") {
std::cout << "q\n";
} else if (inputa == "454349e422f05297191ead13e21d3db520e5abef52055e4964b82fb213f593a1") {
std::cout << "r\n";
} else if (inputa == "043a718774c572bd8a25adbeb1bfcd5c0256ae11cecf9f9c3f925d0e52beaf89") {
std::cout << "s\n";
} else if (inputa == "e3b98a4da31a127d4bde6e43033f66ba274cab0eb7eb1c70ec41402bf6273dd8") {
std::cout << "t\n";
} else if (inputa == "0bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad6") {
std::cout << "u\n";
} else if (inputa == "4c94485e0c21ae6c41ce1dfe7b6bfaceea5ab68e40a2476f50208e526f506080") {
std::cout << "v\n";
} else if (inputa == "50e721e49c013f00c62cf59f2163542a9d8df02464efeb615d31051b0fddc326") {
std::cout << "w\n";
} else if (inputa == "2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881") {
std::cout << "x\n";
} else if (inputa == "a1fce4363854ff888cff4b8e7875d600c2682390412a8cf79b37d0b11148b0fa") {
std::cout << "y\n";
} else if (inputa == "594e519ae499312b29433b7dd8a97ff068defcba9755b6d5d00e84c524d67b06") {
std::cout << "z\n";
} else if (inputa == "fa51fd49abf67705d6a35d18218c115ff5633aec1f9ebfdc9d5d4956416f57f6") {
//more words
std::cout << "is\n";
} else if (inputa == "bb0347a468d97e98a9c00e37cebec1ab930f6f1221cae0f1fbb92b07e1900ba2") {
std::cout << "you\n";
} else if (inputa == "8e7fc0236af43df9340685fc16f1efe36543cc1707051220a103ad99cf69a2df") {
std::cout << "that\n";
} else if (inputa == "2ad8a7049d7c5511ac254f5f51fe70a046ebd884729056f0fe57f5160d467153") {
std::cout << "it\n";
} else if (inputa == "372f7e2fd2d01ce2a1d71dc072acbba4c6fd25a1087cd7f153f4ec0ce37e1ede") {
std::cout << "he\n";
} else if (inputa == "b63b99f6383ba713b57ddfc77737c5f71639fa6f4663efe60a66a8c6d114b545") {
std::cout << "was\n";
} else if (inputa == "10c22bcf4c768b515be4e94bcafc71bf3e8fb5f70b2584bcc8c7533217f2e7f9") {
std::cout << "for\n";
} else if (inputa == "b8d31e852725afb1e26d53bab6095b2bff1749c9275be13ed1c05a56ed31ec09") {
std::cout << "on\n";
} else if (inputa == "ba78973ddcf98d4e5369f5e722d681d94f5106895e5d6cf6fa3ca8240fabdc14") {
std::cout << "are\n";
} else if (inputa == "f4bf9f7fcbedaba0392f108c59d8f4a38b3838efb64877380171b54475c2ade8") {
std::cout << "as\n";
} else if (inputa == "0695b563acde461fc2f8d9aebccf35c7596ac458b8d8e067c602fb7b4e5f1578") {
std::cout << "with\n";
} else if (inputa == "73c9c98668a34c54d131ff609d0bf129068d1b5ed3efd7cdfe753f909596456c") {
std::cout << "his\n";
} else if (inputa == "151e58a831306903b282edb477bb6c4b713887cdd2b0353c84aff6f43da8e95d") {
std::cout << "they\n";
} else if (inputa == "de7d1b721a1e0632b7cf04edf5032c8ecffa9f9a08492152b926f1a5a7e765d7"
) {
std::cout << "i\n";
} else if (inputa == "9390298f3fb0c5b160498935d79cb139aef28e1c47358b4bbba61862b9c26e59"){
std::cout << "no\n";
} else if (inputa == "8a798890fe93817163b10b5f7bd2ca4d25d84c52739a645a889c173eee7d9d3d") {
std::cout << "yes\n";
//funny easter egg
} else if (inputa == "no") {
std::cout << "dont be rude :)\n";
} else if (inputa == "d7469a66c4bb97c09aa84e8536a85f1795761f5fe01ddc8139922b6236f4397d") {
std::cout << "Happy birthday\n https://Birthday.belizairebr25.repl.co\n";
}else{
std::cout << "Secure hash algorithm 256 hash not automatically recognized\n Mining, this may take a while\n";
/*mine goes here, it measures random inputs against the user input to see if the match, encatt is used to measure and att is the attempted solution. It does not et work work yet, the below code is not mine and I am altering it in the hopes of getting it to work*/
std::cout <<"'" << inputa << "' not recognized\n";
/*
static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
int stringLength = sizeof(alphanum) - 1;
char genRandom() // Random string generator function.
{
return alphanum[rand() % stringLength];
}
int main()
{
srand(time(0));
for(int z=0; z < 21; z++)
{
cout << "tried:" << genRandom();
}
return 117;
}
if (input == encatt) {
std::cout << "hash means" << att;
}
*/
}
}
} else {
std::cout << "invalid key, please try again\n";
}
}
}
那是cpp,这里是现有的sqlite,它很少而且做的不多
--Table Creation:
CREATE TABLE SHA ( value TEXT, hash BLOB, id DOUBLE);
--Insert Data:
--D1: 6/14
INSERT INTO SHA (value, id, hash)
VALUES ("test", 1, "532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25");
--Display:
SELECT * FROM SHA;
再次感谢!
恐怕你正在尝试做的事情是不可能的。您的代码中有几个语法错误。我建议使用不同的程序。
我正在尝试结合 C++ 和 SQLite 为 sha-256 哈希创建数据库。我需要数据库来导入、存储和导出 sha-256 哈希值和含义。我已经可以运行 C++ 程序了。该程序要求用户根据需要创建自己的库,我希望为所有用户存储条目。这将扩展库并使其在继续存在时更有用。我对 cpp 还很陌生,所以现有的程序有点基础。我正在寻找的是一种将变量从 cpp 移动到 sqlite 以及干净集成所需的任何其他步骤的方法。 谢谢! 下面是现有的cpp和sqlite
//include libraries
//Sorry,this is in a js compiler becuase i coulnd't figure out how to post it as cpp, the program itsellf works in cpp.
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
//if user wants to run this
std::string yon;
std::cout << "Type 'yes' to add 25 custom hashes to your library, type no to skip.\n";
std::cin >> yon;
if (yon == "yes") {
//int var for user library
std::string hash;
std::string meaning;
std::string hash1;
std::string meaning1;
std::string hash2;
std::string meaning2;
std::string hash3;
std::string meaning3;
std::string hash4;
std::string meaning4;
std::string hash5;
std::string meaning5;
std::string hash6;
std::string meaning6;
std::string hash7;
std::string meaning7;
std::string hash8;
std::string meaning8;
std::string hash9;
std::string meaning9;
std::string hash10;
std::string meaning10;
std::string hash11;
std::string meaning11;
std::string hash12;
std::string meaning12;
std::string hash13;
std::string meaning13;
std::string hash14;
std::string meaning14;
std::string hash15;
std::string meaning15;
std::string hash16;
std::string meaning16;
std::string hash17;
std::string meaning17;
std::string hash18;
std::string meaning18;
std::string hash19;
std::string meaning19;
std::string hash20;
std::string meaning20;
std::string hash21;
std::string meaning21;
std::string hash22;
std::string meaning22;
std::string hash23;
std::string meaning23;
std::string hash24;
std::string meaning24;
//var user library
std::cout << "Do not restart this learning repository or else variables will be forgotten\n";
std::cout << "Enter first hash\n";
std::cin >> hash;
std::cout << "Enter first meaning\n";
std::cin >> meaning;
std::cout << "Enter hash\n";
std::cin >> hash1;
std::cout << "Enter meaning\n";
std::cin >> meaning1;
std::cout << "Enter hash\n";
std::cin >> hash2;
std::cout << "Enter meaning\n";
std::cin >> meaning2;
std::cout << "Enter hash\n";
std::cin >> hash3;
std::cout << "Enter meaning\n";
std::cin >> meaning3;
std::cout << "Enter hash\n";
std::cin >> hash4;
std::cout << "Enter meaning\n";
std::cin >> meaning4;
std::cout << "Enter hash\n";
std::cin >> hash5;
std::cout << "Enter meaning\n";
std::cin >> meaning5;
std::cout << "Enter hash\n";
std::cin >> hash6;
std::cout << "Enter meaning\n";
std::cin >> meaning6;
std::cout << "Enter hash\n";
std::cin >> hash7;
std::cout << "Enter meaning\n";
std::cin >> meaning7;
std::cout << "Enter hash\n";
std::cin >> hash8;
std::cout << "Enter meaning\n";
std::cin >> meaning8;
std::cout << "Enter hash\n";
std::cin >> hash9;
std::cout << "Enter meaning\n";
std::cin >> meaning9;
std::cout << "Enter hash\n";
std::cin >> hash10;
std::cout << "Enter meaning\n";
std::cin >> meaning10;
std::cout << "Enter hash\n";
std::cin >> hash11;
std::cout << "Enter meaning\n";
std::cin >> meaning11;
std::cout << "Enter hash\n";
std::cin >> hash12;
std::cout << "Enter meaning\n";
std::cin >> meaning12;
std::cout << "Enter hash\n";
std::cin >> hash13;
std::cout << "Enter meaning\n";
std::cin >> meaning13;
std::cout << "Enter hash\n";
std::cin >> hash14;
std::cout << "Enter meaning\n";
std::cin >> meaning14;
std::cout << "Enter hash\n";
std::cin >> hash15;
std::cout << "Enter meaning\n";
std::cin >> meaning15;
std::cout << "Enter hash\n";
std::cin >> hash16;
std::cout << "Enter meaning\n";
std::cin >> meaning16;
std::cout << "Enter hash\n";
std::cin >> hash17;
std::cout << "Enter meaning\n";
std::cin >> meaning17;
std::cout << "Enter hash\n";
std::cin >> hash18;
std::cout << "Enter meaning\n";
std::cin >> meaning18;
std::cout << "Enter hash\n";
std::cin >> hash19;
std::cout << "Enter meaning\n";
std::cin >> meaning19;
std::cout << "Enter hash\n";
std::cin >> hash20;
std::cout << "Enter meaning\n";
std::cin >> meaning20;
std::cout << "Enter hash\n";
std::cin >> hash21;
std::cout << "Enter meaning\n";
std::cin >> meaning21;
std::cout << "Enter hash\n";
std::cin >> hash22;
std::cout << "Enter meaning\n";
std::cin >> meaning22;
std::cout << "Enter hash\n";
std::cin >> hash23;
std::cout << "Enter meaning\n";
std::cin >> meaning23;
std::cout << "Enter hash\n";
std::cin >> hash24;
std::cout << "Enter meaning\n";
std::cin >> meaning24;
std::cout << "Done, returning to main program now!\n";
//intilize variables and startup
std::string name;
std::string securitykey = "Echoes";
std::string usersecuritykey;
std::cout << "Please enter the program security key\n (key = Echoes)\n";
std::cin >> usersecuritykey;
//security key
if (usersecuritykey == securitykey) {
std::cout << "Please enter your name\n";
std::cin >> name;
std::cout << "Hello " << name << ", Input First Secure hash algorithm 256 hash to be mined\n";
for( ; ; ) {
std::string input1;
std::cin >> input1;
//if else library
//words
if (input1 == "8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4") {
std::cout << "hi\n";
} else if (input1 == "b49f425a7e1f9cff3856329ada223f2f9d368f15a00cf48df16ca95986137fe8") {
std::cout << "bye\n";
} else if (input1 == "b9776d7ddf459c9ad5b0e1d6ac61e27befb5e99fd62446677600d7cacef544d0") {
std::cout << "the\n";
} else if (input1 == "28391d3bc64ec15cbb090426b04aa6b7649c3cc85f11230bb0105e02d15e3624") {
std::cout << "of\n";
} else if (input1 == "6201111b83a0cb5b0922cb37cc442b9a40e24e3b1ce100a4bb204f4c63fd2ac0") {
std::cout << "and\n";
} else if (input1 == "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb") {
std::cout << "a\n";
} else if (input1 == "663ea1bfffe5038f3f0cf667f14c4257eff52d77ce7f2a218f72e9286616ea39") {
std::cout << "to\n";
} else if (input1 == "582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf") {
std::cout << "in\n";
//letters
} else if (input1 == "3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d") {
std::cout << "b\n";
} else if (input1 == "2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1a25aefc6") {
std::cout << "c\n";
} else if (input1 == "18ac3e7343f016890c510e93f935261169d9e3f565436429830faf0934f4f8e4") {
std::cout << "d\n";
} else if (input1 == "3f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea") {
std::cout << "e\n";
} else if (input1 == "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111") {
std::cout << "f\n";
} else if (input1 == "cd0aa9856147b6c5b4ff2b7dfee5da20aa38253099ef1b4a64aced233c9afe29") {
std::cout << "g\n";
} else if (input1 == "aaa9402664f1a41f40ebbc52c9993eb66aeb366602958fdfaa283b71e64db123") {
std::cout << "h\n";
} else if (input1 == "de7d1b721a1e0632b7cf04edf5032c8ecffa9f9a08492152b926f1a5a7e765d7") {
std::cout << "i\n";
} else if (input1 == "189f40034be7a199f1fa9891668ee3ab6049f82d38c68be70f596eab2e1857b7") {
std::cout << "j\n";
} else if (input1 == "8254c329a92850f6d539dd376f4816ee2764517da5e0235514af433164480d7a") {
std::cout << "k\n";
} else if (input1 == "acac86c0e609ca906f632b0e2dacccb2b77d22b0621f20ebece1a4835b93f6f0") {
std::cout << "l\n";
} else if (input1 == "62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a") {
std::cout << "m\n";
} else if (input1 == "1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9") {
std::cout << "n\n";
} else if (input1 == "65c74c15a686187bb6bbf9958f494fc6b80068034a659a9ad44991b08c58f2d2") {
std::cout << "o\n";
} else if (input1 == "148de9c5a7a44d19e56cd9ae1a554bf67847afb0c58f6e12fa29ac7ddfca9940") {
std::cout << "p\n";
} else if (input1 == "8e35c2cd3bf6641bdb0e2050b76932cbb2e6034a0ddacc1d9bea82a6ba57f7cf") {
std::cout << "q\n";
} else if (input1 == "454349e422f05297191ead13e21d3db520e5abef52055e4964b82fb213f593a1") {
std::cout << "r\n";
} else if (input1 == "043a718774c572bd8a25adbeb1bfcd5c0256ae11cecf9f9c3f925d0e52beaf89") {
std::cout << "s\n";
} else if (input1 == "e3b98a4da31a127d4bde6e43033f66ba274cab0eb7eb1c70ec41402bf6273dd8") {
std::cout << "t\n";
} else if (input1 == "0bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad6") {
std::cout << "u\n";
} else if (input1 == "4c94485e0c21ae6c41ce1dfe7b6bfaceea5ab68e40a2476f50208e526f506080") {
std::cout << "v\n";
} else if (input1 == "50e721e49c013f00c62cf59f2163542a9d8df02464efeb615d31051b0fddc326") {
std::cout << "w\n";
} else if (input1 == "2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881") {
std::cout << "x\n";
} else if (input1 == "a1fce4363854ff888cff4b8e7875d600c2682390412a8cf79b37d0b11148b0fa") {
std::cout << "y\n";
} else if (input1 == "594e519ae499312b29433b7dd8a97ff068defcba9755b6d5d00e84c524d67b06") {
std::cout << "z\n";
} else if (input1 == "fa51fd49abf67705d6a35d18218c115ff5633aec1f9ebfdc9d5d4956416f57f6") {
//more words
std::cout << "is\n";
} else if (input1 == "bb0347a468d97e98a9c00e37cebec1ab930f6f1221cae0f1fbb92b07e1900ba2") {
std::cout << "you\n";
} else if (input1 == "8e7fc0236af43df9340685fc16f1efe36543cc1707051220a103ad99cf69a2df") {
std::cout << "that\n";
} else if (input1 == "2ad8a7049d7c5511ac254f5f51fe70a046ebd884729056f0fe57f5160d467153") {
std::cout << "it\n";
} else if (input1 == "372f7e2fd2d01ce2a1d71dc072acbba4c6fd25a1087cd7f153f4ec0ce37e1ede") {
std::cout << "he\n";
} else if (input1 == "b63b99f6383ba713b57ddfc77737c5f71639fa6f4663efe60a66a8c6d114b545") {
std::cout << "was\n";
} else if (input1 == "10c22bcf4c768b515be4e94bcafc71bf3e8fb5f70b2584bcc8c7533217f2e7f9") {
std::cout << "for\n";
} else if (input1 == "b8d31e852725afb1e26d53bab6095b2bff1749c9275be13ed1c05a56ed31ec09") {
std::cout << "on\n";
} else if (input1 == "ba78973ddcf98d4e5369f5e722d681d94f5106895e5d6cf6fa3ca8240fabdc14") {
std::cout << "are\n";
} else if (input1 == "f4bf9f7fcbedaba0392f108c59d8f4a38b3838efb64877380171b54475c2ade8") {
std::cout << "as\n";
} else if (input1 == "0695b563acde461fc2f8d9aebccf35c7596ac458b8d8e067c602fb7b4e5f1578") {
std::cout << "with\n";
} else if (input1 == "73c9c98668a34c54d131ff609d0bf129068d1b5ed3efd7cdfe753f909596456c") {
std::cout << "his\n";
} else if (input1 == "151e58a831306903b282edb477bb6c4b713887cdd2b0353c84aff6f43da8e95d") {
std::cout << "they\n";
} else if (input1 == "de7d1b721a1e0632b7cf04edf5032c8ecffa9f9a08492152b926f1a5a7e765d7"
) {
std::cout << "i\n";
} else if (input1 == "9390298f3fb0c5b160498935d79cb139aef28e1c47358b4bbba61862b9c26e59"){
std::cout << "no\n";
} else if (input1 == "8a798890fe93817163b10b5f7bd2ca4d25d84c52739a645a889c173eee7d9d3d") {
std::cout << "yes\n";
//funny easter egg
} else if (input1 == "no") {
std::cout << "dont be rude :)\n";
} else if (input1 == "d7469a66c4bb97c09aa84e8536a85f1795761f5fe01ddc8139922b6236f4397d") {
std::cout << "Happy birthday\n https://Birthday.belizairebr25.repl.co\n";
} else if (input1 == hash) {
std::cout << meaning <<"\n";
}else if (input1 == hash1) {
std::cout << meaning1 <<"\n";
}else if (input1 == hash2) {
std::cout << meaning2 <<"\n";
}else if (input1 == hash3) {
std::cout << meaning3 <<"\n";
}else if (input1 == hash4) {
std::cout << meaning4 <<"\n";
}else if (input1 == hash5) {
std::cout << meaning5 <<"\n";
}else if (input1 == hash6) {
std::cout << meaning6 <<"\n";
}else if (input1 == hash7) {
std::cout << meaning7 <<"\n";
}else if (input1 == hash8) {
std::cout << meaning8 <<"\n";
}else if (input1 == hash9) {
std::cout << meaning9 <<"\n";
}else if (input1 == hash10) {
std::cout << meaning10 <<"\n";
}else if (input1 == hash11) {
std::cout << meaning11 <<"\n";
}else if (input1 == hash12) {
std::cout << meaning12 <<"\n";
}else if (input1 == hash13) {
std::cout << meaning13 <<"\n";
}else if (input1 == hash14) {
std::cout << meaning14 <<"\n";
}else if (input1 == hash15) {
std::cout << meaning15 <<"\n";
}else if (input1 == hash16) {
std::cout << meaning16 <<"\n";
}else if (input1 == hash17) {
std::cout << meaning17 <<"\n";
}else if (input1 == hash18) {
std::cout << meaning18 <<"\n";
}else if (input1 == hash19) {
std::cout << meaning19 <<"\n";
}else if (input1 == hash20) {
std::cout << meaning20 <<"\n";
}else if (input1 == hash21) {
std::cout << meaning21 <<"\n";
}else if (input1 == hash22) {
std::cout << meaning22 <<"\n";
}else if (input1 == hash23) {
std::cout << meaning23 <<"\n";
}else if (input1 == hash24) {
std::cout << meaning24 <<"\n";
}
std::cout << "Enter next hash\n";
}
}else{
std::cout << "Secure hash algorithm 256 hash not automatically recognized.\n Mining, this may take a while\n";
/*mine goes here, it measures random inputs against the user input to see if the match, encatt is used to measure and att is the attempted solution. It does not et work work yet, the below code is not mine and I am altering it in the hopes of getting it to work*/
std::cout << "Hash not recognized\n";
}
} else {
//no custom library option/object2
//intilize variables and startup
std::string name;
std::string securitykey = "Echoes";
std::string usersecuritykey;
std::cout << "Please enter the program security key\n (key = Echoes)\n";
std::cin >> usersecuritykey;
//security key
if (usersecuritykey == securitykey) {
std::cout << "Please enter your name\n";
std::cin >> name;
for( ; ; ) {
std::cout << "Hello " << name << ", Input Secure hash algorithm 256 hash to be mined\n";
std::string inputa;
std::cin >> inputa;
//if else library
//words
if (inputa == "8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4") {
std::cout << "hi\n";
} else if (inputa == "b49f425a7e1f9cff3856329ada223f2f9d368f15a00cf48df16ca95986137fe8") {
std::cout << "bye\n";
} else if (inputa == "b9776d7ddf459c9ad5b0e1d6ac61e27befb5e99fd62446677600d7cacef544d0") {
std::cout << "the\n";
} else if (inputa == "28391d3bc64ec15cbb090426b04aa6b7649c3cc85f11230bb0105e02d15e3624") {
std::cout << "of\n";
} else if (inputa == "6201111b83a0cb5b0922cb37cc442b9a40e24e3b1ce100a4bb204f4c63fd2ac0") {
std::cout << "and\n";
} else if (inputa == "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb") {
std::cout << "a\n";
} else if (inputa == "663ea1bfffe5038f3f0cf667f14c4257eff52d77ce7f2a218f72e9286616ea39") {
std::cout << "to\n";
} else if (inputa == "582967534d0f909d196b97f9e6921342777aea87b46fa52df165389db1fb8ccf") {
std::cout << "in\n";
//letters
} else if (inputa == "3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d") {
std::cout << "b\n";
} else if (inputa == "2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1a25aefc6") {
std::cout << "c\n";
} else if (inputa == "18ac3e7343f016890c510e93f935261169d9e3f565436429830faf0934f4f8e4") {
std::cout << "d\n";
} else if (inputa == "3f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea") {
std::cout << "e\n";
} else if (inputa == "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111") {
std::cout << "f\n";
} else if (inputa == "cd0aa9856147b6c5b4ff2b7dfee5da20aa38253099ef1b4a64aced233c9afe29") {
std::cout << "g\n";
} else if (inputa == "aaa9402664f1a41f40ebbc52c9993eb66aeb366602958fdfaa283b71e64db123") {
std::cout << "h\n";
} else if (inputa == "de7d1b721a1e0632b7cf04edf5032c8ecffa9f9a08492152b926f1a5a7e765d7") {
std::cout << "i\n";
} else if (inputa == "189f40034be7a199f1fa9891668ee3ab6049f82d38c68be70f596eab2e1857b7") {
std::cout << "j\n";
} else if (inputa == "8254c329a92850f6d539dd376f4816ee2764517da5e0235514af433164480d7a") {
std::cout << "k\n";
} else if (inputa == "acac86c0e609ca906f632b0e2dacccb2b77d22b0621f20ebece1a4835b93f6f0") {
std::cout << "l\n";
} else if (inputa == "62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a") {
std::cout << "m\n";
} else if (inputa == "1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9") {
std::cout << "n\n";
} else if (inputa == "65c74c15a686187bb6bbf9958f494fc6b80068034a659a9ad44991b08c58f2d2") {
std::cout << "o\n";
} else if (inputa == "148de9c5a7a44d19e56cd9ae1a554bf67847afb0c58f6e12fa29ac7ddfca9940") {
std::cout << "p\n";
} else if (inputa == "8e35c2cd3bf6641bdb0e2050b76932cbb2e6034a0ddacc1d9bea82a6ba57f7cf") {
std::cout << "q\n";
} else if (inputa == "454349e422f05297191ead13e21d3db520e5abef52055e4964b82fb213f593a1") {
std::cout << "r\n";
} else if (inputa == "043a718774c572bd8a25adbeb1bfcd5c0256ae11cecf9f9c3f925d0e52beaf89") {
std::cout << "s\n";
} else if (inputa == "e3b98a4da31a127d4bde6e43033f66ba274cab0eb7eb1c70ec41402bf6273dd8") {
std::cout << "t\n";
} else if (inputa == "0bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad6") {
std::cout << "u\n";
} else if (inputa == "4c94485e0c21ae6c41ce1dfe7b6bfaceea5ab68e40a2476f50208e526f506080") {
std::cout << "v\n";
} else if (inputa == "50e721e49c013f00c62cf59f2163542a9d8df02464efeb615d31051b0fddc326") {
std::cout << "w\n";
} else if (inputa == "2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881") {
std::cout << "x\n";
} else if (inputa == "a1fce4363854ff888cff4b8e7875d600c2682390412a8cf79b37d0b11148b0fa") {
std::cout << "y\n";
} else if (inputa == "594e519ae499312b29433b7dd8a97ff068defcba9755b6d5d00e84c524d67b06") {
std::cout << "z\n";
} else if (inputa == "fa51fd49abf67705d6a35d18218c115ff5633aec1f9ebfdc9d5d4956416f57f6") {
//more words
std::cout << "is\n";
} else if (inputa == "bb0347a468d97e98a9c00e37cebec1ab930f6f1221cae0f1fbb92b07e1900ba2") {
std::cout << "you\n";
} else if (inputa == "8e7fc0236af43df9340685fc16f1efe36543cc1707051220a103ad99cf69a2df") {
std::cout << "that\n";
} else if (inputa == "2ad8a7049d7c5511ac254f5f51fe70a046ebd884729056f0fe57f5160d467153") {
std::cout << "it\n";
} else if (inputa == "372f7e2fd2d01ce2a1d71dc072acbba4c6fd25a1087cd7f153f4ec0ce37e1ede") {
std::cout << "he\n";
} else if (inputa == "b63b99f6383ba713b57ddfc77737c5f71639fa6f4663efe60a66a8c6d114b545") {
std::cout << "was\n";
} else if (inputa == "10c22bcf4c768b515be4e94bcafc71bf3e8fb5f70b2584bcc8c7533217f2e7f9") {
std::cout << "for\n";
} else if (inputa == "b8d31e852725afb1e26d53bab6095b2bff1749c9275be13ed1c05a56ed31ec09") {
std::cout << "on\n";
} else if (inputa == "ba78973ddcf98d4e5369f5e722d681d94f5106895e5d6cf6fa3ca8240fabdc14") {
std::cout << "are\n";
} else if (inputa == "f4bf9f7fcbedaba0392f108c59d8f4a38b3838efb64877380171b54475c2ade8") {
std::cout << "as\n";
} else if (inputa == "0695b563acde461fc2f8d9aebccf35c7596ac458b8d8e067c602fb7b4e5f1578") {
std::cout << "with\n";
} else if (inputa == "73c9c98668a34c54d131ff609d0bf129068d1b5ed3efd7cdfe753f909596456c") {
std::cout << "his\n";
} else if (inputa == "151e58a831306903b282edb477bb6c4b713887cdd2b0353c84aff6f43da8e95d") {
std::cout << "they\n";
} else if (inputa == "de7d1b721a1e0632b7cf04edf5032c8ecffa9f9a08492152b926f1a5a7e765d7"
) {
std::cout << "i\n";
} else if (inputa == "9390298f3fb0c5b160498935d79cb139aef28e1c47358b4bbba61862b9c26e59"){
std::cout << "no\n";
} else if (inputa == "8a798890fe93817163b10b5f7bd2ca4d25d84c52739a645a889c173eee7d9d3d") {
std::cout << "yes\n";
//funny easter egg
} else if (inputa == "no") {
std::cout << "dont be rude :)\n";
} else if (inputa == "d7469a66c4bb97c09aa84e8536a85f1795761f5fe01ddc8139922b6236f4397d") {
std::cout << "Happy birthday\n https://Birthday.belizairebr25.repl.co\n";
}else{
std::cout << "Secure hash algorithm 256 hash not automatically recognized\n Mining, this may take a while\n";
/*mine goes here, it measures random inputs against the user input to see if the match, encatt is used to measure and att is the attempted solution. It does not et work work yet, the below code is not mine and I am altering it in the hopes of getting it to work*/
std::cout <<"'" << inputa << "' not recognized\n";
/*
static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
int stringLength = sizeof(alphanum) - 1;
char genRandom() // Random string generator function.
{
return alphanum[rand() % stringLength];
}
int main()
{
srand(time(0));
for(int z=0; z < 21; z++)
{
cout << "tried:" << genRandom();
}
return 117;
}
if (input == encatt) {
std::cout << "hash means" << att;
}
*/
}
}
} else {
std::cout << "invalid key, please try again\n";
}
}
}
那是cpp,这里是现有的sqlite,它很少而且做的不多
--Table Creation:
CREATE TABLE SHA ( value TEXT, hash BLOB, id DOUBLE);
--Insert Data:
--D1: 6/14
INSERT INTO SHA (value, id, hash)
VALUES ("test", 1, "532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25");
--Display:
SELECT * FROM SHA;
再次感谢!
恐怕你正在尝试做的事情是不可能的。您的代码中有几个语法错误。我建议使用不同的程序。