qtxie / backup Goto Github PK
View Code? Open in Web Editor NEWBackup
Backup
Mmm, these cakes on the pictures looks very well, if you need help to pass some tests let me know! π
Red/System []
#enum crypt-algorithm! [
AES
DES
_3DES
RC4
]
#enum block-chaining! [
ECB
CBC
;CFB8
;CFB64
;CFB128
GCM
CCM
;GMAC
;CMAC
]
rs-crypt: context [
#import [
]
verbose: 0
#define DPrint(msg) [#if debug? = yes [if verbose > 0 [print-line msg]]]
;== Symmetric Algorithms
encypt-init: func [
alg [crypt-algorithm!]
IV [byte-ptr!] ;-- initialization vector
key [byte-ptr!]
key-len [uint!] ;-- AES: 128, 192 or 256, DES: 56, 3DES: 56, 112, 168
chain-mode [block-chaining!] ;-- CBC, ECB, GCM, etc
return: [handle!] ;-- null if error
][
DPrint("encypt-init")
]
encypt-update: func [
hCrypt [handle!] ;-- handle returned by make
data [byte-ptr!]
data-len [uint!]
outbuf [byte-ptr!]
outlen [int-ptr!]
return: [integer!] ;-- error code
][]
encrypt-final: func [
hCrypt [handle!] ;-- handle returned by make
outbuf [byte-ptr!]
outlen [int-ptr!]
return: [integer!]
][]
decrypt-init: func [
alg [crypt-algorithm!]
IV [byte-ptr!] ;-- initialization vector
key [byte-ptr!]
key-len [uint!] ;-- AES: 128, 192 or 256, DES: 56, 3DES: 56, 112, 168
chain-mode [block-chaining!] ;-- CBC, ECB, GCM, etc
return: [handle!] ;-- null if error
][]
decrypt-update: func [
hCrypt [handle!] ;-- handle returned by make
data [byte-ptr!]
data-len [uint!]
outbuf [byte-ptr!]
outlen [int-ptr!]
return: [integer!] ;-- error code
][]
decrypt-final: func [
hCrypt [handle!] ;-- handle returned by make
outbuf [byte-ptr!]
outlen [int-ptr!]
return: [integer!]
][]
set-property: func [ ;-- set IV length, tag length, etc.
hCrypt [handle!] ;-- handle returned by make
property [integer!]
input [byte-ptr!]
input-len [integer!]
return: [integer!]
]
get-property: func [
hCrypt [handle!] ;-- handle returned by make
property [integer!]
output [byte-ptr!]
output-len [int-ptr!]
return: [integer!]
]
;== Asymmetric Algorithms
;-- RSA
;-- DSA
;== Key Exchange Algorithms
;-- ECDH, ECDSA, etc
;== Hashing Algorithms
;-- SHA, MD5, etc
]
In addition to the shiny GUI backends in Red, now we have an old school text-based user inferfaces (TUI) backend for the View engine.
The new TUI backend has a quite limited features set compared to the GUI backends. Here are features implemented:
base
, panel
, button
, field
, text
, progress
, rich-text
, image
and text-list
.text
. Both string!
and rich-text!
are supported.key-down
and key
events. Actually they are the same event with different names. The terminals only send a single key event, no down
and up
event.system/view/platform/mouse-event?: yes
to enable it./rate
facets./offset
, /size
, /text
, /image
, /color
, /data
, /enabled?
, /visible?
, /selected
, /flags
, /options
, /pane
, /rate
, /para
and /draw
.password
and all-over
./text
facet. Only Colors / Graphics Mode codes.To use the TUI backend, add Config: [GUI-engine: 'terminal]
in addition to Needs: View
in the Red header block.
Red [
Title: "Red TUI App"
Needs: View
Config: [GUI-engine: 'terminal]
]
Here are a few examples, starting with a Hello World!:
>> view [text "Hello TUI World!"]
Hello TUI World!
Press ESC to exit the event loop.
A progress bar with animation.
view [
bar: progress 30% rate 10 on-time [
data: face/data + 10%
face/data: either data > 100% [0%][data]
info/text: form face/data
info/font/color: random white
]
info: text 4 font-color white "30%"
]
A rich-text example:
btn-quit: rtd-layout [i/red ["Q"] "uit"]
view compose/deep [
rich-text 40x3 transparent data [
yellow "Hello" <bg> white red " Red " </bg> green "World!^/"
u "Underline" /u " " s "Strike" /s i " Italic" /i
] return
button "button 1"
button 4x2 draw [text 0x0 (btn-quit)] [unview/all]
]
Press TAB
key to switch focus between the buttons. Press Enter
key to push the button.
An example of enable mouse. Note not all the terminals support mouse.
system/view/platform/mouse-event?: yes
view [
panel 80x20 [
base 11x1 center "drag meπ" loose
]
]
There are more examples on the red repository and the community. Here are a few screenshots of them.
Show image in both TUI and GUI.
TUI Cat by GiuseppeChillemi
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.