int passVerif( // crc = 4002471382
int (*_strcmp) (const char*, const char*),
int (*_printf) (const char*, ...),
void (*_exit) (int),
char* (*_cryptStr) (char*),
char* ppw,
char* pw,
char* err
) {
char* begin_ptr;
char* end_ptr;
__asm {
lea eax, begin
mov begin_ptr, eax
lea eax, end
mov end_ptr, eax
}
int size = (int)(end_ptr - begin_ptr);
begin:;
if (_strcmp(ppw, _cryptStr(pw)) != 0) {
_printf(_cryptStr(err));
_exit(-96);
}
end:;
uint32_t crc = 0xFFFFFFFF;
for (int i = 0; i < size; i++) {
unsigned char byte = *(begin_ptr + i);
crc ^= byte;
for (size_t j = 0; j < 8; j++) {
if (crc & 1) {
crc = (crc >> 1) ^ POLYNOMIAL;
}
else {
crc >>= 1;
}
}
// printf("%02X ", byte);
}
//printf("\n");
printf("CRC = %u\n", ~crc); //crc = 4002471382
return size;
}
func GETRenderPage(tmplname string, c *gin.Context, posts Posts, data string) {
pageNumber := GETBadassSavior(tmplname, c)
if pageNumber == -1 {
return
}
sl := posts.GetSublistByPagenumber(pageNumber)
fmt.Println(sl)
c.HTML(http.StatusOK, tmplname+".html", GetPageContext(c, pageNumber, posts, data))
}
func GetPageContext(c *gin.Context, pageNumber int, posts Posts, data string) *Page {
accessLvl := getAccessLvl(c)
sl := posts.GetSublistByPagenumber(pageNumber)
fmt.Println(sl)
return &Page{
AccessLvl: accessLvl,
Title: "hikan.ru",
Posts: posts,
Tags: t, // список всех тегов
Number: pageNumber,
Data: data,
}
}
{{ define "getposts" }}
{{ range .Posts.GetSublistByPagenumber .Number }}
<a class="fetch" href="/post/{{ .ID }}">
{{ if eq .Lock 0 }}
<div class="post">
<div class="post-title"><span class="gray">[PUBLIC]</span> {{ .Title }}</div>
<div class="post-date">Опубликовано: {{ .PostingTime }} -- Обновлено: {{ .UpdateTime }}</div>
{{ if ne .Tags "" }}
<div class="post-tags">
{{ range SplitString .Tags " " }}{{ . }} {{ end }}
</div>
{{ end }}
<div class="post-body">{{ .GetPostDescription }}</div>
</div>
{{ else }}
<div class="post red-border">
<div class="post-title"><span class="gray">[PRIVATE] </span>{{ .Title }}</div>
<div class="post-date">Опубликовано: {{ .PostingTime }} -- Обновлено: {{ .UpdateTime }}</div>
{{ if ne .Tags "" }}
<div class="post-tags">
{{ range SplitString .Tags " " }}{{ . }} {{ end }}
</div>
{{ end }}
<div class="post-body">{{ .GetPostDescription }}</div>
</div>
{{ end }}
</a>
{{ end }}
{{ end }}