readline

ASP.NET 国密加密 SM2-SM4

℡╲_俬逩灬. 提交于 2021-02-02 01:46:21
新建一个控制台来做demo nuget引用程序集:KYSharp.SM 安装 2.0 版本,里面才有sm3和sm4的加密 一、SM2的用法 static void SM2Console() { // 公钥 string publickey = "" ; // 私钥 string privatekey = "" ; // 生成公钥和私钥 SM2Utils.GenerateKeyPair( out publickey, out privatekey); System.Console.Out.WriteLine( " 加密明文: " + " 000000 " ); System.Console.Out.WriteLine( " publickey: " + publickey); // 开始加密 string cipherText = SM2Utils.Encrypt(publickey, " 000000 " ); System.Console.Out.WriteLine( " 密文: " + cipherText); System.Console.Out.WriteLine( " privatekey: " + privatekey); // 解密 string plainText = SM2Utils.Decrypt(privatekey, cipherText); System

Java基础系列:计算机网络基础概念

坚强是说给别人听的谎言 提交于 2021-01-30 01:45:07
来 小伙伴们 ,我们认识一下。 俗世游子 :专注技术研究的程序猿 网络 大部分情况下,做开发的程序猿是是不需要和网络打交道的,就比如本人:工作这么多年,去年年初做过一次系统架构,做负载均衡的时候顺带了解了一下这方面的基础知识,其他时候根本用不到。 我们现在就来简单聊一聊,简单到什么程度: 开发涉及到网络IO方面的问题能知道该怎么解决, 面试能说个七七八八就够了 基本知识 首先我们先要明白什么是 网络 : 不负责任的说, 网络 是 网络是由若干节点和连接这些节点的链路构成 ,而这些物理链路将多台计算机连接在一起,组成了我们现在的互联网 促进网络产生的先决条件: 芯片技术 要知道,世界上第一台计算机有一个教室那么大,直到集成电路的产生,将电路做到一块完整的半导体硅板上,计算机的体积才下降下来 网络理论本身 第二个条件就是网络理论本身,我们现在知道,网络本身分为很多节点,各个节点之间相互关联,我们从起点A发送数据到终点B,发送的数据在网络中会拆分成小包,由于光电传输是非常快的,所以在数据包在网络中传输的时候会通过不同的路线到达终点B,然后在终点B中进行合并 在这个理论中,两个人的贡献非常大: Paul Baran 提出的 分布式可适应信息块交换集成电路 Donald Davies 提出的 封包交换 两者说的是一个问题,就是封包交换算法,解决数据如何从一个点通过复杂网络到达另一个点的问题

Suppress printing a new prompt when pressing tab with Readline

随声附和 提交于 2021-01-29 18:15:43
问题 When using the auto completion with the Readline library in C, the prompt is reprinted when typing the tab key twice: (prompt) view NAME_OF_F (user presses tab twice) NAME_OF_FILE1 NAME_OF_FILE2 (suggestions by Readline) (prompt) view NAME_OF_F I'd like to suppress the reprinting of the prompt on the 3rd line by keeping the first line printed with the suggestions below it like such: (prompt) view NAME_OF_F (user presses tab twice) NAME_OF_FILE1 NAME_OF_FILE2 (suggestions by Readline) I'd like

TypeError: fs.readFileSync is not a function

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-29 08:59:02
问题 My project require to use filesystem module in ReactJS. The project was created with create-react-app. In one of the component js file, I need to load lines in a textfile from a directory. var fs = require('fs'); var readline = require('readline'); var stream = fs.readFileSync( C:/data/localmap.txt" ).toString().split("\n"); ....... There isn't error in the terminal, but the browser shows error as shown below: TypeError: fs.readFileSync is not a function Different from the issue raised here,

“set completion-ignore-case on ” ignored in ~/.inputrc

巧了我就是萌 提交于 2021-01-28 06:12:39
问题 I'm attempting to set completion-ignore-case on in my ~/.inputrc , but the option seems to be ignored. When I hit tab, only case-sensitive matches are shown. Here's my ~/.inputrc : # Bash input configuration set completion-ignore-case on #Enable case-insensitive tab-complete "\e[A": history-search-backward #Press up or down arrow to search through shell history on what you've already typed "\e[B": history-search-forward #"\e[1;9C": forward-word #alt-left/right to move the cursor by words #"\e

boost: readline for tcp client

拟墨画扇 提交于 2021-01-28 04:20:45
问题 I'm developing a tcp server in c++ using boost. I'd like process incoming data line by line and am looking for a socket.readLine method. However, I can only find a read_some() method. I don't what the definition on "some" is, but I don't think the string necessarily ends with a "\n". So how can I implement socket.readLine() using boost? 回答1: I assume you are using boost::asio. If so, there is a read_until() function that does what you want. http://www.boost.org/doc/libs/1_47_0/doc/html/boost

Read text file (Unicode) in 'C' using native Win32

亡梦爱人 提交于 2021-01-27 05:42:20
问题 I have a line-oriented text file (Unicode) that was created using CreateFile() and WriteFile(). Reading that file as a binary stream using ReadFile() is straightforward, but extra low-level processing is needed to break it into lines. Is there a Win32 function that does this for me? Again, please note that it's in 'C' (not C++) and I don't want to use POSIX/ANSI C functions such as readline(). If the answer to the aforementioned question is negative, what would be the "shortest code" to

js制作一个伪银行取款atm机

徘徊边缘 提交于 2021-01-26 08:24:27
运行环境node.js const readline = require('readline-sync'); let num = 0; let users = [['liuwujiang', '659'], ['yingyingying', '111'], ['1', '1']]; let isOk = true; let userName, password; while (true) { //判断是否退出 while (true) { //判断登录是否成功 console.log('1' + '.' + ' ' + '登录'); console.log('2' + '.' + ' ' + '注册'); console.log('请选择(1-2):') let sel = readline.question(); if (sel === '1') { console.log("请输入用户名:"); userName = readline.question(); console.log("请输入密码:"); password = readline.question(); let islogin = false; for (let i = 0; i < users.length; i++) { if (users[i][0] == userName && users[i][1] ==

dotnet Core 异步任务

血红的双手。 提交于 2021-01-24 13:37:44
使用线程池中线程的任务启动方式 线程池提供了一个后台线程的池,独自管理线程,按需增加或减少线程池中的线程数。线程池中的线程用于执行一些动作后仍然返回线程池中。 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.IO; namespace TaskSamples { class Program { static void Main() { TasksUsingThreadPool(); Console.ReadLine(); } static void TasksUsingThreadPool() { var tf = new TaskFactory(); Task t1 = tf.StartNew(TaskMethod, "using a task factory"); Task t2 = Task.Factory.StartNew(TaskMethod, "factory via a task"); var t3 = new Task(TaskMethod, "using a task constructor and Start

JavaScript模拟ATM业务

两盒软妹~` 提交于 2021-01-23 14:06:25
const readline = require("readline-sync" ); let time = 0; // 输密码次数 let x = 1; // 临时变量 console.log("请输入您的密码" ); let password = readline.question() - 0 ; while (password != 123456 ) { console.log( "您输入的密码有误,请重新输入" ); password = readline.question() - 0 ; time ++ ; if (time == 2 ) { console.log( "密码三次错误,卡已被锁定" ); break ; } } // 以上为确认密码正确 if (password == 123456 ){ let balance = 2000; // 默认卡内余额为两千 while (x == 1 ) { console.log( "请选择业务" ); console.log( "1.存款" ); console.log( "2.取款" ); console.log( "3.查看" ); console.log( "4.退出" ); let check = readline.question() - 0 ; while (isNaN(check) || check < 1