-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit be94409
Showing
9 changed files
with
726 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/target | ||
|
||
|
||
# Added by cargo | ||
# | ||
# already existing elements were commented out | ||
|
||
#/target | ||
/Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"svg.preview.background": "black" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "biosvg" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["Reverier-Xu <reverier.xu@xdsec.club>"] | ||
description = "Captcha based on SVG." | ||
homepage = "https://github.com/XDSEC/biosvg" | ||
documentation = "https://docs.rs/biosvg" | ||
repository = "https://github.com/XDSEC/biosvg" | ||
readme = "README.md" | ||
license = "MPL-2.0" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
once_cell = "1.18" | ||
rand = "0.8" | ||
regex = "1.9" | ||
thiserror = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# BioSvg | ||
|
||
Captcha based on SVG. | ||
|
||
## Original idea | ||
|
||
[SVG绘制原理与验证码](https://blog.woooo.tech/posts/svg_1/) | ||
|
||
## Usage | ||
|
||
`cargo add biosvg` | ||
|
||
```rust | ||
let (answer, svg) = BiosvgBuilder::new() | ||
.length(4) | ||
.difficulty(6) | ||
.colors(vec![ | ||
"#0078D6".to_string(), | ||
"#aa3333".to_string(), | ||
"#f08012".to_string(), | ||
"#33aa00".to_string(), | ||
"#aa33aa".to_string(), | ||
]) | ||
.build() | ||
.unwrap(); | ||
println!("answer: {}", answer); | ||
println!("svg: {}", svg); | ||
``` | ||
|
||
## Example | ||
|
||
![ncuz](samples/ncuz.svg) | ||
![wxgc](samples/wxgc.svg) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.